#26 upgrades dependencies
This commit is contained in:
parent
bbe5ed2a22
commit
e73405c9cd
124 changed files with 7284 additions and 2964 deletions
8
go.mod
8
go.mod
|
|
@ -9,8 +9,8 @@ require (
|
||||||
github.com/aws/aws-sdk-go-v2 v1.26.1
|
github.com/aws/aws-sdk-go-v2 v1.26.1
|
||||||
github.com/aws/aws-sdk-go-v2/config v1.27.11
|
github.com/aws/aws-sdk-go-v2/config v1.27.11
|
||||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.11
|
github.com/aws/aws-sdk-go-v2/credentials v1.17.11
|
||||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.13
|
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.14
|
||||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.31.1
|
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.0
|
||||||
github.com/aws/aws-sdk-go-v2/service/kinesis v1.27.4
|
github.com/aws/aws-sdk-go-v2/service/kinesis v1.27.4
|
||||||
github.com/awslabs/kinesis-aggregation/go/v2 v2.0.0-20230808105340-e631fe742486
|
github.com/awslabs/kinesis-aggregation/go/v2 v2.0.0-20230808105340-e631fe742486
|
||||||
github.com/go-sql-driver/mysql v1.8.1
|
github.com/go-sql-driver/mysql v1.8.1
|
||||||
|
|
@ -37,10 +37,10 @@ require (
|
||||||
github.com/aws/smithy-go v1.20.2 // indirect
|
github.com/aws/smithy-go v1.20.2 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.4 // indirect
|
||||||
github.com/gomodule/redigo v2.0.0+incompatible // indirect
|
github.com/gomodule/redigo v2.0.0+incompatible // indirect
|
||||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||||
github.com/stretchr/testify v1.9.0 // indirect
|
github.com/stretchr/testify v1.9.0 // indirect
|
||||||
github.com/yuin/gopher-lua v0.0.0-20200603152657-dc2b0ca8b37e // indirect
|
github.com/yuin/gopher-lua v0.0.0-20200603152657-dc2b0ca8b37e // indirect
|
||||||
google.golang.org/protobuf v1.26.0 // indirect
|
google.golang.org/protobuf v1.34.1 // indirect
|
||||||
)
|
)
|
||||||
|
|
|
||||||
14
go.sum
14
go.sum
|
|
@ -21,8 +21,8 @@ github.com/aws/aws-sdk-go-v2/config v1.27.11 h1:f47rANd2LQEYHda2ddSCKYId18/8BhSR
|
||||||
github.com/aws/aws-sdk-go-v2/config v1.27.11/go.mod h1:SMsV78RIOYdve1vf36z8LmnszlRWkwMQtomCAI0/mIE=
|
github.com/aws/aws-sdk-go-v2/config v1.27.11/go.mod h1:SMsV78RIOYdve1vf36z8LmnszlRWkwMQtomCAI0/mIE=
|
||||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.11 h1:YuIB1dJNf1Re822rriUOTxopaHHvIq0l/pX3fwO+Tzs=
|
github.com/aws/aws-sdk-go-v2/credentials v1.17.11 h1:YuIB1dJNf1Re822rriUOTxopaHHvIq0l/pX3fwO+Tzs=
|
||||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.11/go.mod h1:AQtFPsDH9bI2O+71anW6EKL+NcD7LG3dpKGMV4SShgo=
|
github.com/aws/aws-sdk-go-v2/credentials v1.17.11/go.mod h1:AQtFPsDH9bI2O+71anW6EKL+NcD7LG3dpKGMV4SShgo=
|
||||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.13 h1:loQ4VSt3hTm9n8ST9jveArwmhqAc5aiRJXlxLPxCNTw=
|
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.14 h1:MqN3V/VApAVAheStH43Dl3BWuGE712Cp5s97WmCMbYQ=
|
||||||
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.13/go.mod h1:RjdeQvzJuUf9jWj+ta+7l3VnVpDZ+RmtP/p+QdwRIpI=
|
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.14/go.mod h1:WwwihVdoE2S7TTziJGvgWaHI8HlOt1DwO6DM338pkzo=
|
||||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 h1:FVJ0r5XTHSmIHJV6KuDmdYhEpvlHpiSd38RQWhut5J4=
|
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 h1:FVJ0r5XTHSmIHJV6KuDmdYhEpvlHpiSd38RQWhut5J4=
|
||||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1/go.mod h1:zusuAeqezXzAB24LGuzuekqMAEgWkVYukBec3kr3jUg=
|
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1/go.mod h1:zusuAeqezXzAB24LGuzuekqMAEgWkVYukBec3kr3jUg=
|
||||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 h1:aw39xVGeRWlWx9EzGVnhOR4yOjQDHPQ6o6NmBlscyQg=
|
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 h1:aw39xVGeRWlWx9EzGVnhOR4yOjQDHPQ6o6NmBlscyQg=
|
||||||
|
|
@ -31,8 +31,8 @@ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 h1:PG1F3OD1szkuQPzDw3C
|
||||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5/go.mod h1:jU1li6RFryMz+so64PpKtudI+QzbKoIEivqdf6LNpOc=
|
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5/go.mod h1:jU1li6RFryMz+so64PpKtudI+QzbKoIEivqdf6LNpOc=
|
||||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU=
|
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU=
|
||||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY=
|
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY=
|
||||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.31.1 h1:dZXY07Dm59TxAjJcUfNMJHLDI/gLMxTRZefn2jFAVsw=
|
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.0 h1:tGV+9T7NwSJNky5tGLh6/i7CoIkd9fPiGWDn9u4PWgI=
|
||||||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.31.1/go.mod h1:lVLqEtX+ezgtfalyJs7Peb0uv9dEpAQP5yuq2O26R44=
|
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.32.0/go.mod h1:lVLqEtX+ezgtfalyJs7Peb0uv9dEpAQP5yuq2O26R44=
|
||||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.4 h1:hSwDD19/e01z3pfyx+hDeX5T/0Sn+ZEnnTO5pVWKWx8=
|
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.4 h1:hSwDD19/e01z3pfyx+hDeX5T/0Sn+ZEnnTO5pVWKWx8=
|
||||||
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.4/go.mod h1:61CuGwE7jYn0g2gl7K3qoT4vCY59ZQEixkPu8PN5IrE=
|
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.20.4/go.mod h1:61CuGwE7jYn0g2gl7K3qoT4vCY59ZQEixkPu8PN5IrE=
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs=
|
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs=
|
||||||
|
|
@ -78,8 +78,9 @@ github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqw
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
|
||||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||||
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0=
|
github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0=
|
||||||
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
||||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
|
@ -152,8 +153,9 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
|
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
|
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
||||||
|
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
|
|
|
||||||
4
vendor/github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue/CHANGELOG.md
generated
vendored
4
vendor/github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue/CHANGELOG.md
generated
vendored
|
|
@ -1,3 +1,7 @@
|
||||||
|
# v1.13.14 (2024-05-02)
|
||||||
|
|
||||||
|
* **Dependency Update**: Updated to the latest SDK module versions
|
||||||
|
|
||||||
# v1.13.13 (2024-03-29)
|
# v1.13.13 (2024-03-29)
|
||||||
|
|
||||||
* **Dependency Update**: Updated to the latest SDK module versions
|
* **Dependency Update**: Updated to the latest SDK module versions
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,4 @@
|
||||||
package attributevalue
|
package attributevalue
|
||||||
|
|
||||||
// goModuleVersion is the tagged release for this module
|
// goModuleVersion is the tagged release for this module
|
||||||
const goModuleVersion = "1.13.13"
|
const goModuleVersion = "1.13.14"
|
||||||
|
|
|
||||||
4
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/CHANGELOG.md
generated
vendored
4
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/CHANGELOG.md
generated
vendored
|
|
@ -1,3 +1,7 @@
|
||||||
|
# v1.32.0 (2024-05-02)
|
||||||
|
|
||||||
|
* **Feature**: This release adds support to specify an optional, maximum OnDemandThroughput for DynamoDB tables and global secondary indexes in the CreateTable or UpdateTable APIs. You can also override the OnDemandThroughput settings by calling the ImportTable, RestoreFromPointInTime, or RestoreFromBackup APIs.
|
||||||
|
|
||||||
# v1.31.1 (2024-03-29)
|
# v1.31.1 (2024-03-29)
|
||||||
|
|
||||||
* **Dependency Update**: Updated to the latest SDK module versions
|
* **Dependency Update**: Updated to the latest SDK module versions
|
||||||
|
|
|
||||||
16
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateTable.go
generated
vendored
16
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateTable.go
generated
vendored
|
|
@ -140,6 +140,11 @@ type CreateTableInput struct {
|
||||||
// as two distinct attributes when determining the total.
|
// as two distinct attributes when determining the total.
|
||||||
LocalSecondaryIndexes []types.LocalSecondaryIndex
|
LocalSecondaryIndexes []types.LocalSecondaryIndex
|
||||||
|
|
||||||
|
// Sets the maximum number of read and write units for the specified table in
|
||||||
|
// on-demand capacity mode. If you use this parameter, you must specify
|
||||||
|
// MaxReadRequestUnits , MaxWriteRequestUnits , or both.
|
||||||
|
OnDemandThroughput *types.OnDemandThroughput
|
||||||
|
|
||||||
// Represents the provisioned throughput settings for a specified table or index.
|
// Represents the provisioned throughput settings for a specified table or index.
|
||||||
// The settings can be modified using the UpdateTable operation. If you set
|
// The settings can be modified using the UpdateTable operation. If you set
|
||||||
// BillingMode as PROVISIONED , you must specify this property. If you set
|
// BillingMode as PROVISIONED , you must specify this property. If you set
|
||||||
|
|
@ -151,12 +156,11 @@ type CreateTableInput struct {
|
||||||
|
|
||||||
// An Amazon Web Services resource-based policy document in JSON format that will
|
// An Amazon Web Services resource-based policy document in JSON format that will
|
||||||
// be attached to the table. When you attach a resource-based policy while creating
|
// be attached to the table. When you attach a resource-based policy while creating
|
||||||
// a table, the policy creation is strongly consistent. The maximum size supported
|
// a table, the policy application is strongly consistent. The maximum size
|
||||||
// for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when
|
// supported for a resource-based policy document is 20 KB. DynamoDB counts
|
||||||
// calculating the size of a policy against this limit. You can’t request an
|
// whitespaces when calculating the size of a policy against this limit. For a full
|
||||||
// increase for this limit. For a full list of all considerations that you should
|
// list of all considerations that apply for resource-based policies, see
|
||||||
// keep in mind while attaching a resource-based policy, see Resource-based policy
|
// Resource-based policy considerations (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html)
|
||||||
// considerations (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html)
|
|
||||||
// .
|
// .
|
||||||
ResourcePolicy *string
|
ResourcePolicy *string
|
||||||
|
|
||||||
|
|
|
||||||
2
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteResourcePolicy.go
generated
vendored
2
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteResourcePolicy.go
generated
vendored
|
|
@ -61,7 +61,7 @@ type DeleteResourcePolicyInput struct {
|
||||||
|
|
||||||
type DeleteResourcePolicyOutput struct {
|
type DeleteResourcePolicyOutput struct {
|
||||||
|
|
||||||
// A unique string that represents the revision ID of the policy. If you are
|
// A unique string that represents the revision ID of the policy. If you're
|
||||||
// comparing revision IDs, make sure to always use string comparison logic. This
|
// comparing revision IDs, make sure to always use string comparison logic. This
|
||||||
// value will be empty if you make a request against a resource without a policy.
|
// value will be empty if you make a request against a resource without a policy.
|
||||||
RevisionId *string
|
RevisionId *string
|
||||||
|
|
|
||||||
14
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_GetResourcePolicy.go
generated
vendored
14
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_GetResourcePolicy.go
generated
vendored
|
|
@ -28,12 +28,12 @@ import (
|
||||||
// Because GetResourcePolicy uses an eventually consistent query, the metadata for
|
// Because GetResourcePolicy uses an eventually consistent query, the metadata for
|
||||||
// your policy or table might not be available at that moment. Wait for a few
|
// your policy or table might not be available at that moment. Wait for a few
|
||||||
// seconds, and then retry the GetResourcePolicy request. After a GetResourcePolicy
|
// seconds, and then retry the GetResourcePolicy request. After a GetResourcePolicy
|
||||||
// request returns a policy created using the PutResourcePolicy request, you can
|
// request returns a policy created using the PutResourcePolicy request, the
|
||||||
// assume the policy will start getting applied in the authorization of requests to
|
// policy will be applied in the authorization of requests to the resource. Because
|
||||||
// the resource. Because this process is eventually consistent, it will take some
|
// this process is eventually consistent, it will take some time to apply the
|
||||||
// time to apply the policy to all requests to a resource. Policies that you attach
|
// policy to all requests to a resource. Policies that you attach while creating a
|
||||||
// while creating a table using the CreateTable request will always be applied to
|
// table using the CreateTable request will always be applied to all requests for
|
||||||
// all requests for that table.
|
// that table.
|
||||||
func (c *Client) GetResourcePolicy(ctx context.Context, params *GetResourcePolicyInput, optFns ...func(*Options)) (*GetResourcePolicyOutput, error) {
|
func (c *Client) GetResourcePolicy(ctx context.Context, params *GetResourcePolicyInput, optFns ...func(*Options)) (*GetResourcePolicyOutput, error) {
|
||||||
if params == nil {
|
if params == nil {
|
||||||
params = &GetResourcePolicyInput{}
|
params = &GetResourcePolicyInput{}
|
||||||
|
|
@ -66,7 +66,7 @@ type GetResourcePolicyOutput struct {
|
||||||
// table or stream, in JSON format.
|
// table or stream, in JSON format.
|
||||||
Policy *string
|
Policy *string
|
||||||
|
|
||||||
// A unique string that represents the revision ID of the policy. If you are
|
// A unique string that represents the revision ID of the policy. If you're
|
||||||
// comparing revision IDs, make sure to always use string comparison logic.
|
// comparing revision IDs, make sure to always use string comparison logic.
|
||||||
RevisionId *string
|
RevisionId *string
|
||||||
|
|
||||||
|
|
|
||||||
18
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_PutResourcePolicy.go
generated
vendored
18
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_PutResourcePolicy.go
generated
vendored
|
|
@ -16,7 +16,7 @@ import (
|
||||||
// application is eventually consistent (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html)
|
// application is eventually consistent (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html)
|
||||||
// . PutResourcePolicy is an idempotent operation; running it multiple times on
|
// . PutResourcePolicy is an idempotent operation; running it multiple times on
|
||||||
// the same resource using the same policy document will return the same revision
|
// the same resource using the same policy document will return the same revision
|
||||||
// ID. If you specify an ExpectedRevisionId which doesn't match the current
|
// ID. If you specify an ExpectedRevisionId that doesn't match the current
|
||||||
// policy's RevisionId , the PolicyNotFoundException will be returned.
|
// policy's RevisionId , the PolicyNotFoundException will be returned.
|
||||||
// PutResourcePolicy is an asynchronous operation. If you issue a GetResourcePolicy
|
// PutResourcePolicy is an asynchronous operation. If you issue a GetResourcePolicy
|
||||||
// request immediately after a PutResourcePolicy request, DynamoDB might return
|
// request immediately after a PutResourcePolicy request, DynamoDB might return
|
||||||
|
|
@ -41,10 +41,14 @@ func (c *Client) PutResourcePolicy(ctx context.Context, params *PutResourcePolic
|
||||||
|
|
||||||
type PutResourcePolicyInput struct {
|
type PutResourcePolicyInput struct {
|
||||||
|
|
||||||
// An Amazon Web Services resource-based policy document in JSON format. The
|
// An Amazon Web Services resource-based policy document in JSON format.
|
||||||
// maximum size supported for a resource-based policy document is 20 KB. DynamoDB
|
// - The maximum size supported for a resource-based policy document is 20 KB.
|
||||||
// counts whitespaces when calculating the size of a policy against this limit. For
|
// DynamoDB counts whitespaces when calculating the size of a policy against this
|
||||||
// a full list of all considerations that you should keep in mind while attaching a
|
// limit.
|
||||||
|
// - Within a resource-based policy, if the action for a DynamoDB service-linked
|
||||||
|
// role (SLR) to replicate data for a global table is denied, adding or deleting a
|
||||||
|
// replica will fail with an error.
|
||||||
|
// For a full list of all considerations that apply while attaching a
|
||||||
// resource-based policy, see Resource-based policy considerations (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html)
|
// resource-based policy, see Resource-based policy considerations (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html)
|
||||||
// .
|
// .
|
||||||
//
|
//
|
||||||
|
|
@ -72,7 +76,7 @@ type PutResourcePolicyInput struct {
|
||||||
// against that policy. When you provide an expected revision ID, if the revision
|
// against that policy. When you provide an expected revision ID, if the revision
|
||||||
// ID of the existing policy on the resource doesn't match or if there's no policy
|
// ID of the existing policy on the resource doesn't match or if there's no policy
|
||||||
// attached to the resource, your request will be rejected with a
|
// attached to the resource, your request will be rejected with a
|
||||||
// PolicyNotFoundException . To conditionally put a policy when no policy exists
|
// PolicyNotFoundException . To conditionally attach a policy when no policy exists
|
||||||
// for the resource, specify NO_POLICY for the revision ID.
|
// for the resource, specify NO_POLICY for the revision ID.
|
||||||
ExpectedRevisionId *string
|
ExpectedRevisionId *string
|
||||||
|
|
||||||
|
|
@ -81,7 +85,7 @@ type PutResourcePolicyInput struct {
|
||||||
|
|
||||||
type PutResourcePolicyOutput struct {
|
type PutResourcePolicyOutput struct {
|
||||||
|
|
||||||
// A unique string that represents the revision ID of the policy. If you are
|
// A unique string that represents the revision ID of the policy. If you're
|
||||||
// comparing revision IDs, make sure to always use string comparison logic.
|
// comparing revision IDs, make sure to always use string comparison logic.
|
||||||
RevisionId *string
|
RevisionId *string
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,11 @@ type RestoreTableFromBackupInput struct {
|
||||||
// of the indexes at the time of restore.
|
// of the indexes at the time of restore.
|
||||||
LocalSecondaryIndexOverride []types.LocalSecondaryIndex
|
LocalSecondaryIndexOverride []types.LocalSecondaryIndex
|
||||||
|
|
||||||
|
// Sets the maximum number of read and write units for the specified on-demand
|
||||||
|
// table. If you use this parameter, you must specify MaxReadRequestUnits ,
|
||||||
|
// MaxWriteRequestUnits , or both.
|
||||||
|
OnDemandThroughputOverride *types.OnDemandThroughput
|
||||||
|
|
||||||
// Provisioned throughput settings for the restored table.
|
// Provisioned throughput settings for the restored table.
|
||||||
ProvisionedThroughputOverride *types.ProvisionedThroughput
|
ProvisionedThroughputOverride *types.ProvisionedThroughput
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,11 @@ type RestoreTableToPointInTimeInput struct {
|
||||||
// of the indexes at the time of restore.
|
// of the indexes at the time of restore.
|
||||||
LocalSecondaryIndexOverride []types.LocalSecondaryIndex
|
LocalSecondaryIndexOverride []types.LocalSecondaryIndex
|
||||||
|
|
||||||
|
// Sets the maximum number of read and write units for the specified on-demand
|
||||||
|
// table. If you use this parameter, you must specify MaxReadRequestUnits ,
|
||||||
|
// MaxWriteRequestUnits , or both.
|
||||||
|
OnDemandThroughputOverride *types.OnDemandThroughput
|
||||||
|
|
||||||
// Provisioned throughput settings for the restored table.
|
// Provisioned throughput settings for the restored table.
|
||||||
ProvisionedThroughputOverride *types.ProvisionedThroughput
|
ProvisionedThroughputOverride *types.ProvisionedThroughput
|
||||||
|
|
||||||
|
|
|
||||||
5
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTable.go
generated
vendored
5
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTable.go
generated
vendored
|
|
@ -82,6 +82,11 @@ type UpdateTableInput struct {
|
||||||
// in the Amazon DynamoDB Developer Guide.
|
// in the Amazon DynamoDB Developer Guide.
|
||||||
GlobalSecondaryIndexUpdates []types.GlobalSecondaryIndexUpdate
|
GlobalSecondaryIndexUpdates []types.GlobalSecondaryIndexUpdate
|
||||||
|
|
||||||
|
// Updates the maximum number of read and write units for the specified table in
|
||||||
|
// on-demand capacity mode. If you use this parameter, you must specify
|
||||||
|
// MaxReadRequestUnits , MaxWriteRequestUnits , or both.
|
||||||
|
OnDemandThroughput *types.OnDemandThroughput
|
||||||
|
|
||||||
// The new provisioned throughput settings for the specified table or index.
|
// The new provisioned throughput settings for the specified table or index.
|
||||||
ProvisionedThroughput *types.ProvisionedThroughput
|
ProvisionedThroughput *types.ProvisionedThroughput
|
||||||
|
|
||||||
|
|
|
||||||
141
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/deserializers.go
generated
vendored
141
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/deserializers.go
generated
vendored
|
|
@ -10628,6 +10628,11 @@ func awsAwsjson10_deserializeDocumentGlobalSecondaryIndex(v **types.GlobalSecond
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "OnDemandThroughput":
|
||||||
|
if err := awsAwsjson10_deserializeDocumentOnDemandThroughput(&sv.OnDemandThroughput, value); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
case "Projection":
|
case "Projection":
|
||||||
if err := awsAwsjson10_deserializeDocumentProjection(&sv.Projection, value); err != nil {
|
if err := awsAwsjson10_deserializeDocumentProjection(&sv.Projection, value); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -10736,6 +10741,11 @@ func awsAwsjson10_deserializeDocumentGlobalSecondaryIndexDescription(v **types.G
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "OnDemandThroughput":
|
||||||
|
if err := awsAwsjson10_deserializeDocumentOnDemandThroughput(&sv.OnDemandThroughput, value); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
case "Projection":
|
case "Projection":
|
||||||
if err := awsAwsjson10_deserializeDocumentProjection(&sv.Projection, value); err != nil {
|
if err := awsAwsjson10_deserializeDocumentProjection(&sv.Projection, value); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -10859,6 +10869,11 @@ func awsAwsjson10_deserializeDocumentGlobalSecondaryIndexInfo(v **types.GlobalSe
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "OnDemandThroughput":
|
||||||
|
if err := awsAwsjson10_deserializeDocumentOnDemandThroughput(&sv.OnDemandThroughput, value); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
case "Projection":
|
case "Projection":
|
||||||
if err := awsAwsjson10_deserializeDocumentProjection(&sv.Projection, value); err != nil {
|
if err := awsAwsjson10_deserializeDocumentProjection(&sv.Projection, value); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -12986,6 +13001,107 @@ func awsAwsjson10_deserializeDocumentNumberSetAttributeValue(v *[]string, value
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func awsAwsjson10_deserializeDocumentOnDemandThroughput(v **types.OnDemandThroughput, value interface{}) error {
|
||||||
|
if v == nil {
|
||||||
|
return fmt.Errorf("unexpected nil of type %T", v)
|
||||||
|
}
|
||||||
|
if value == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
shape, ok := value.(map[string]interface{})
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unexpected JSON type %v", value)
|
||||||
|
}
|
||||||
|
|
||||||
|
var sv *types.OnDemandThroughput
|
||||||
|
if *v == nil {
|
||||||
|
sv = &types.OnDemandThroughput{}
|
||||||
|
} else {
|
||||||
|
sv = *v
|
||||||
|
}
|
||||||
|
|
||||||
|
for key, value := range shape {
|
||||||
|
switch key {
|
||||||
|
case "MaxReadRequestUnits":
|
||||||
|
if value != nil {
|
||||||
|
jtv, ok := value.(json.Number)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("expected LongObject to be json.Number, got %T instead", value)
|
||||||
|
}
|
||||||
|
i64, err := jtv.Int64()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sv.MaxReadRequestUnits = ptr.Int64(i64)
|
||||||
|
}
|
||||||
|
|
||||||
|
case "MaxWriteRequestUnits":
|
||||||
|
if value != nil {
|
||||||
|
jtv, ok := value.(json.Number)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("expected LongObject to be json.Number, got %T instead", value)
|
||||||
|
}
|
||||||
|
i64, err := jtv.Int64()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sv.MaxWriteRequestUnits = ptr.Int64(i64)
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
_, _ = key, value
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*v = sv
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func awsAwsjson10_deserializeDocumentOnDemandThroughputOverride(v **types.OnDemandThroughputOverride, value interface{}) error {
|
||||||
|
if v == nil {
|
||||||
|
return fmt.Errorf("unexpected nil of type %T", v)
|
||||||
|
}
|
||||||
|
if value == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
shape, ok := value.(map[string]interface{})
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unexpected JSON type %v", value)
|
||||||
|
}
|
||||||
|
|
||||||
|
var sv *types.OnDemandThroughputOverride
|
||||||
|
if *v == nil {
|
||||||
|
sv = &types.OnDemandThroughputOverride{}
|
||||||
|
} else {
|
||||||
|
sv = *v
|
||||||
|
}
|
||||||
|
|
||||||
|
for key, value := range shape {
|
||||||
|
switch key {
|
||||||
|
case "MaxReadRequestUnits":
|
||||||
|
if value != nil {
|
||||||
|
jtv, ok := value.(json.Number)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("expected LongObject to be json.Number, got %T instead", value)
|
||||||
|
}
|
||||||
|
i64, err := jtv.Int64()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sv.MaxReadRequestUnits = ptr.Int64(i64)
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
_, _ = key, value
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*v = sv
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func awsAwsjson10_deserializeDocumentPartiQLBatchResponse(v *[]types.BatchStatementResponse, value interface{}) error {
|
func awsAwsjson10_deserializeDocumentPartiQLBatchResponse(v *[]types.BatchStatementResponse, value interface{}) error {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
return fmt.Errorf("unexpected nil of type %T", v)
|
return fmt.Errorf("unexpected nil of type %T", v)
|
||||||
|
|
@ -13744,6 +13860,11 @@ func awsAwsjson10_deserializeDocumentReplicaDescription(v **types.ReplicaDescrip
|
||||||
sv.KMSMasterKeyId = ptr.String(jtv)
|
sv.KMSMasterKeyId = ptr.String(jtv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "OnDemandThroughputOverride":
|
||||||
|
if err := awsAwsjson10_deserializeDocumentOnDemandThroughputOverride(&sv.OnDemandThroughputOverride, value); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
case "ProvisionedThroughputOverride":
|
case "ProvisionedThroughputOverride":
|
||||||
if err := awsAwsjson10_deserializeDocumentProvisionedThroughputOverride(&sv.ProvisionedThroughputOverride, value); err != nil {
|
if err := awsAwsjson10_deserializeDocumentProvisionedThroughputOverride(&sv.ProvisionedThroughputOverride, value); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -13973,6 +14094,11 @@ func awsAwsjson10_deserializeDocumentReplicaGlobalSecondaryIndexDescription(v **
|
||||||
sv.IndexName = ptr.String(jtv)
|
sv.IndexName = ptr.String(jtv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "OnDemandThroughputOverride":
|
||||||
|
if err := awsAwsjson10_deserializeDocumentOnDemandThroughputOverride(&sv.OnDemandThroughputOverride, value); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
case "ProvisionedThroughputOverride":
|
case "ProvisionedThroughputOverride":
|
||||||
if err := awsAwsjson10_deserializeDocumentProvisionedThroughputOverride(&sv.ProvisionedThroughputOverride, value); err != nil {
|
if err := awsAwsjson10_deserializeDocumentProvisionedThroughputOverride(&sv.ProvisionedThroughputOverride, value); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -14684,6 +14810,11 @@ func awsAwsjson10_deserializeDocumentSourceTableDetails(v **types.SourceTableDet
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "OnDemandThroughput":
|
||||||
|
if err := awsAwsjson10_deserializeDocumentOnDemandThroughput(&sv.OnDemandThroughput, value); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
case "ProvisionedThroughput":
|
case "ProvisionedThroughput":
|
||||||
if err := awsAwsjson10_deserializeDocumentProvisionedThroughput(&sv.ProvisionedThroughput, value); err != nil {
|
if err := awsAwsjson10_deserializeDocumentProvisionedThroughput(&sv.ProvisionedThroughput, value); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -15223,6 +15354,11 @@ func awsAwsjson10_deserializeDocumentTableCreationParameters(v **types.TableCrea
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "OnDemandThroughput":
|
||||||
|
if err := awsAwsjson10_deserializeDocumentOnDemandThroughput(&sv.OnDemandThroughput, value); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
case "ProvisionedThroughput":
|
case "ProvisionedThroughput":
|
||||||
if err := awsAwsjson10_deserializeDocumentProvisionedThroughput(&sv.ProvisionedThroughput, value); err != nil {
|
if err := awsAwsjson10_deserializeDocumentProvisionedThroughput(&sv.ProvisionedThroughput, value); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -15368,6 +15504,11 @@ func awsAwsjson10_deserializeDocumentTableDescription(v **types.TableDescription
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "OnDemandThroughput":
|
||||||
|
if err := awsAwsjson10_deserializeDocumentOnDemandThroughput(&sv.OnDemandThroughput, value); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
case "ProvisionedThroughput":
|
case "ProvisionedThroughput":
|
||||||
if err := awsAwsjson10_deserializeDocumentProvisionedThroughputDescription(&sv.ProvisionedThroughput, value); err != nil {
|
if err := awsAwsjson10_deserializeDocumentProvisionedThroughputDescription(&sv.ProvisionedThroughput, value); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
2
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/go_module_metadata.go
generated
vendored
2
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/go_module_metadata.go
generated
vendored
|
|
@ -3,4 +3,4 @@
|
||||||
package dynamodb
|
package dynamodb
|
||||||
|
|
||||||
// goModuleVersion is the tagged release for this module
|
// goModuleVersion is the tagged release for this module
|
||||||
const goModuleVersion = "1.31.1"
|
const goModuleVersion = "1.32.0"
|
||||||
|
|
|
||||||
106
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/serializers.go
generated
vendored
106
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/serializers.go
generated
vendored
|
|
@ -3547,6 +3547,13 @@ func awsAwsjson10_serializeDocumentCreateGlobalSecondaryIndexAction(v *types.Cre
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.OnDemandThroughput != nil {
|
||||||
|
ok := object.Key("OnDemandThroughput")
|
||||||
|
if err := awsAwsjson10_serializeDocumentOnDemandThroughput(v.OnDemandThroughput, ok); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if v.Projection != nil {
|
if v.Projection != nil {
|
||||||
ok := object.Key("Projection")
|
ok := object.Key("Projection")
|
||||||
if err := awsAwsjson10_serializeDocumentProjection(v.Projection, ok); err != nil {
|
if err := awsAwsjson10_serializeDocumentProjection(v.Projection, ok); err != nil {
|
||||||
|
|
@ -3592,6 +3599,13 @@ func awsAwsjson10_serializeDocumentCreateReplicationGroupMemberAction(v *types.C
|
||||||
ok.String(*v.KMSMasterKeyId)
|
ok.String(*v.KMSMasterKeyId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.OnDemandThroughputOverride != nil {
|
||||||
|
ok := object.Key("OnDemandThroughputOverride")
|
||||||
|
if err := awsAwsjson10_serializeDocumentOnDemandThroughputOverride(v.OnDemandThroughputOverride, ok); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if v.ProvisionedThroughputOverride != nil {
|
if v.ProvisionedThroughputOverride != nil {
|
||||||
ok := object.Key("ProvisionedThroughputOverride")
|
ok := object.Key("ProvisionedThroughputOverride")
|
||||||
if err := awsAwsjson10_serializeDocumentProvisionedThroughputOverride(v.ProvisionedThroughputOverride, ok); err != nil {
|
if err := awsAwsjson10_serializeDocumentProvisionedThroughputOverride(v.ProvisionedThroughputOverride, ok); err != nil {
|
||||||
|
|
@ -3880,6 +3894,13 @@ func awsAwsjson10_serializeDocumentGlobalSecondaryIndex(v *types.GlobalSecondary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.OnDemandThroughput != nil {
|
||||||
|
ok := object.Key("OnDemandThroughput")
|
||||||
|
if err := awsAwsjson10_serializeDocumentOnDemandThroughput(v.OnDemandThroughput, ok); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if v.Projection != nil {
|
if v.Projection != nil {
|
||||||
ok := object.Key("Projection")
|
ok := object.Key("Projection")
|
||||||
if err := awsAwsjson10_serializeDocumentProjection(v.Projection, ok); err != nil {
|
if err := awsAwsjson10_serializeDocumentProjection(v.Projection, ok); err != nil {
|
||||||
|
|
@ -4263,6 +4284,35 @@ func awsAwsjson10_serializeDocumentNumberSetAttributeValue(v []string, value smi
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func awsAwsjson10_serializeDocumentOnDemandThroughput(v *types.OnDemandThroughput, value smithyjson.Value) error {
|
||||||
|
object := value.Object()
|
||||||
|
defer object.Close()
|
||||||
|
|
||||||
|
if v.MaxReadRequestUnits != nil {
|
||||||
|
ok := object.Key("MaxReadRequestUnits")
|
||||||
|
ok.Long(*v.MaxReadRequestUnits)
|
||||||
|
}
|
||||||
|
|
||||||
|
if v.MaxWriteRequestUnits != nil {
|
||||||
|
ok := object.Key("MaxWriteRequestUnits")
|
||||||
|
ok.Long(*v.MaxWriteRequestUnits)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func awsAwsjson10_serializeDocumentOnDemandThroughputOverride(v *types.OnDemandThroughputOverride, value smithyjson.Value) error {
|
||||||
|
object := value.Object()
|
||||||
|
defer object.Close()
|
||||||
|
|
||||||
|
if v.MaxReadRequestUnits != nil {
|
||||||
|
ok := object.Key("MaxReadRequestUnits")
|
||||||
|
ok.Long(*v.MaxReadRequestUnits)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func awsAwsjson10_serializeDocumentParameterizedStatement(v *types.ParameterizedStatement, value smithyjson.Value) error {
|
func awsAwsjson10_serializeDocumentParameterizedStatement(v *types.ParameterizedStatement, value smithyjson.Value) error {
|
||||||
object := value.Object()
|
object := value.Object()
|
||||||
defer object.Close()
|
defer object.Close()
|
||||||
|
|
@ -4522,6 +4572,13 @@ func awsAwsjson10_serializeDocumentReplicaGlobalSecondaryIndex(v *types.ReplicaG
|
||||||
ok.String(*v.IndexName)
|
ok.String(*v.IndexName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.OnDemandThroughputOverride != nil {
|
||||||
|
ok := object.Key("OnDemandThroughputOverride")
|
||||||
|
if err := awsAwsjson10_serializeDocumentOnDemandThroughputOverride(v.OnDemandThroughputOverride, ok); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if v.ProvisionedThroughputOverride != nil {
|
if v.ProvisionedThroughputOverride != nil {
|
||||||
ok := object.Key("ProvisionedThroughputOverride")
|
ok := object.Key("ProvisionedThroughputOverride")
|
||||||
if err := awsAwsjson10_serializeDocumentProvisionedThroughputOverride(v.ProvisionedThroughputOverride, ok); err != nil {
|
if err := awsAwsjson10_serializeDocumentProvisionedThroughputOverride(v.ProvisionedThroughputOverride, ok); err != nil {
|
||||||
|
|
@ -4853,6 +4910,13 @@ func awsAwsjson10_serializeDocumentTableCreationParameters(v *types.TableCreatio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.OnDemandThroughput != nil {
|
||||||
|
ok := object.Key("OnDemandThroughput")
|
||||||
|
if err := awsAwsjson10_serializeDocumentOnDemandThroughput(v.OnDemandThroughput, ok); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if v.ProvisionedThroughput != nil {
|
if v.ProvisionedThroughput != nil {
|
||||||
ok := object.Key("ProvisionedThroughput")
|
ok := object.Key("ProvisionedThroughput")
|
||||||
if err := awsAwsjson10_serializeDocumentProvisionedThroughput(v.ProvisionedThroughput, ok); err != nil {
|
if err := awsAwsjson10_serializeDocumentProvisionedThroughput(v.ProvisionedThroughput, ok); err != nil {
|
||||||
|
|
@ -5065,6 +5129,13 @@ func awsAwsjson10_serializeDocumentUpdateGlobalSecondaryIndexAction(v *types.Upd
|
||||||
ok.String(*v.IndexName)
|
ok.String(*v.IndexName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.OnDemandThroughput != nil {
|
||||||
|
ok := object.Key("OnDemandThroughput")
|
||||||
|
if err := awsAwsjson10_serializeDocumentOnDemandThroughput(v.OnDemandThroughput, ok); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if v.ProvisionedThroughput != nil {
|
if v.ProvisionedThroughput != nil {
|
||||||
ok := object.Key("ProvisionedThroughput")
|
ok := object.Key("ProvisionedThroughput")
|
||||||
if err := awsAwsjson10_serializeDocumentProvisionedThroughput(v.ProvisionedThroughput, ok); err != nil {
|
if err := awsAwsjson10_serializeDocumentProvisionedThroughput(v.ProvisionedThroughput, ok); err != nil {
|
||||||
|
|
@ -5103,6 +5174,13 @@ func awsAwsjson10_serializeDocumentUpdateReplicationGroupMemberAction(v *types.U
|
||||||
ok.String(*v.KMSMasterKeyId)
|
ok.String(*v.KMSMasterKeyId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.OnDemandThroughputOverride != nil {
|
||||||
|
ok := object.Key("OnDemandThroughputOverride")
|
||||||
|
if err := awsAwsjson10_serializeDocumentOnDemandThroughputOverride(v.OnDemandThroughputOverride, ok); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if v.ProvisionedThroughputOverride != nil {
|
if v.ProvisionedThroughputOverride != nil {
|
||||||
ok := object.Key("ProvisionedThroughputOverride")
|
ok := object.Key("ProvisionedThroughputOverride")
|
||||||
if err := awsAwsjson10_serializeDocumentProvisionedThroughputOverride(v.ProvisionedThroughputOverride, ok); err != nil {
|
if err := awsAwsjson10_serializeDocumentProvisionedThroughputOverride(v.ProvisionedThroughputOverride, ok); err != nil {
|
||||||
|
|
@ -5297,6 +5375,13 @@ func awsAwsjson10_serializeOpDocumentCreateTableInput(v *CreateTableInput, value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.OnDemandThroughput != nil {
|
||||||
|
ok := object.Key("OnDemandThroughput")
|
||||||
|
if err := awsAwsjson10_serializeDocumentOnDemandThroughput(v.OnDemandThroughput, ok); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if v.ProvisionedThroughput != nil {
|
if v.ProvisionedThroughput != nil {
|
||||||
ok := object.Key("ProvisionedThroughput")
|
ok := object.Key("ProvisionedThroughput")
|
||||||
if err := awsAwsjson10_serializeDocumentProvisionedThroughput(v.ProvisionedThroughput, ok); err != nil {
|
if err := awsAwsjson10_serializeDocumentProvisionedThroughput(v.ProvisionedThroughput, ok); err != nil {
|
||||||
|
|
@ -6276,6 +6361,13 @@ func awsAwsjson10_serializeOpDocumentRestoreTableFromBackupInput(v *RestoreTable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.OnDemandThroughputOverride != nil {
|
||||||
|
ok := object.Key("OnDemandThroughputOverride")
|
||||||
|
if err := awsAwsjson10_serializeDocumentOnDemandThroughput(v.OnDemandThroughputOverride, ok); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if v.ProvisionedThroughputOverride != nil {
|
if v.ProvisionedThroughputOverride != nil {
|
||||||
ok := object.Key("ProvisionedThroughputOverride")
|
ok := object.Key("ProvisionedThroughputOverride")
|
||||||
if err := awsAwsjson10_serializeDocumentProvisionedThroughput(v.ProvisionedThroughputOverride, ok); err != nil {
|
if err := awsAwsjson10_serializeDocumentProvisionedThroughput(v.ProvisionedThroughputOverride, ok); err != nil {
|
||||||
|
|
@ -6321,6 +6413,13 @@ func awsAwsjson10_serializeOpDocumentRestoreTableToPointInTimeInput(v *RestoreTa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.OnDemandThroughputOverride != nil {
|
||||||
|
ok := object.Key("OnDemandThroughputOverride")
|
||||||
|
if err := awsAwsjson10_serializeDocumentOnDemandThroughput(v.OnDemandThroughputOverride, ok); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if v.ProvisionedThroughputOverride != nil {
|
if v.ProvisionedThroughputOverride != nil {
|
||||||
ok := object.Key("ProvisionedThroughputOverride")
|
ok := object.Key("ProvisionedThroughputOverride")
|
||||||
if err := awsAwsjson10_serializeDocumentProvisionedThroughput(v.ProvisionedThroughputOverride, ok); err != nil {
|
if err := awsAwsjson10_serializeDocumentProvisionedThroughput(v.ProvisionedThroughputOverride, ok); err != nil {
|
||||||
|
|
@ -6783,6 +6882,13 @@ func awsAwsjson10_serializeOpDocumentUpdateTableInput(v *UpdateTableInput, value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.OnDemandThroughput != nil {
|
||||||
|
ok := object.Key("OnDemandThroughput")
|
||||||
|
if err := awsAwsjson10_serializeDocumentOnDemandThroughput(v.OnDemandThroughput, ok); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if v.ProvisionedThroughput != nil {
|
if v.ProvisionedThroughput != nil {
|
||||||
ok := object.Key("ProvisionedThroughput")
|
ok := object.Key("ProvisionedThroughput")
|
||||||
if err := awsAwsjson10_serializeDocumentProvisionedThroughput(v.ProvisionedThroughput, ok); err != nil {
|
if err := awsAwsjson10_serializeDocumentProvisionedThroughput(v.ProvisionedThroughput, ok); err != nil {
|
||||||
|
|
|
||||||
93
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/types/types.go
generated
vendored
93
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/types/types.go
generated
vendored
|
|
@ -838,6 +838,11 @@ type CreateGlobalSecondaryIndexAction struct {
|
||||||
// This member is required.
|
// This member is required.
|
||||||
Projection *Projection
|
Projection *Projection
|
||||||
|
|
||||||
|
// The maximum number of read and write units for the global secondary index being
|
||||||
|
// created. If you use this parameter, you must specify MaxReadRequestUnits ,
|
||||||
|
// MaxWriteRequestUnits , or both.
|
||||||
|
OnDemandThroughput *OnDemandThroughput
|
||||||
|
|
||||||
// Represents the provisioned throughput settings for the specified global
|
// Represents the provisioned throughput settings for the specified global
|
||||||
// secondary index. For current minimum and maximum provisioned throughput values,
|
// secondary index. For current minimum and maximum provisioned throughput values,
|
||||||
// see Service, Account, and Table Quotas (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html)
|
// see Service, Account, and Table Quotas (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html)
|
||||||
|
|
@ -875,6 +880,11 @@ type CreateReplicationGroupMemberAction struct {
|
||||||
// from the default DynamoDB KMS key alias/aws/dynamodb .
|
// from the default DynamoDB KMS key alias/aws/dynamodb .
|
||||||
KMSMasterKeyId *string
|
KMSMasterKeyId *string
|
||||||
|
|
||||||
|
// The maximum on-demand throughput settings for the specified replica table being
|
||||||
|
// created. You can only modify MaxReadRequestUnits , because you can't modify
|
||||||
|
// MaxWriteRequestUnits for individual replica tables.
|
||||||
|
OnDemandThroughputOverride *OnDemandThroughputOverride
|
||||||
|
|
||||||
// Replica-specific provisioned throughput. If not specified, uses the source
|
// Replica-specific provisioned throughput. If not specified, uses the source
|
||||||
// table's provisioned throughput settings.
|
// table's provisioned throughput settings.
|
||||||
ProvisionedThroughputOverride *ProvisionedThroughputOverride
|
ProvisionedThroughputOverride *ProvisionedThroughputOverride
|
||||||
|
|
@ -1324,6 +1334,11 @@ type GlobalSecondaryIndex struct {
|
||||||
// This member is required.
|
// This member is required.
|
||||||
Projection *Projection
|
Projection *Projection
|
||||||
|
|
||||||
|
// The maximum number of read and write units for the specified global secondary
|
||||||
|
// index. If you use this parameter, you must specify MaxReadRequestUnits ,
|
||||||
|
// MaxWriteRequestUnits , or both.
|
||||||
|
OnDemandThroughput *OnDemandThroughput
|
||||||
|
|
||||||
// Represents the provisioned throughput settings for the specified global
|
// Represents the provisioned throughput settings for the specified global
|
||||||
// secondary index. For current minimum and maximum provisioned throughput values,
|
// secondary index. For current minimum and maximum provisioned throughput values,
|
||||||
// see Service, Account, and Table Quotas (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html)
|
// see Service, Account, and Table Quotas (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html)
|
||||||
|
|
@ -1398,6 +1413,11 @@ type GlobalSecondaryIndexDescription struct {
|
||||||
// partition key physically close together, in sorted order by the sort key value.
|
// partition key physically close together, in sorted order by the sort key value.
|
||||||
KeySchema []KeySchemaElement
|
KeySchema []KeySchemaElement
|
||||||
|
|
||||||
|
// The maximum number of read and write units for the specified global secondary
|
||||||
|
// index. If you use this parameter, you must specify MaxReadRequestUnits ,
|
||||||
|
// MaxWriteRequestUnits , or both.
|
||||||
|
OnDemandThroughput *OnDemandThroughput
|
||||||
|
|
||||||
// Represents attributes that are copied (projected) from the table into the
|
// Represents attributes that are copied (projected) from the table into the
|
||||||
// global secondary index. These are in addition to the primary key attributes and
|
// global secondary index. These are in addition to the primary key attributes and
|
||||||
// index key attributes, which are automatically projected.
|
// index key attributes, which are automatically projected.
|
||||||
|
|
@ -1431,6 +1451,11 @@ type GlobalSecondaryIndexInfo struct {
|
||||||
// partition key physically close together, in sorted order by the sort key value.
|
// partition key physically close together, in sorted order by the sort key value.
|
||||||
KeySchema []KeySchemaElement
|
KeySchema []KeySchemaElement
|
||||||
|
|
||||||
|
// Sets the maximum number of read and write units for the specified on-demand
|
||||||
|
// table. If you use this parameter, you must specify MaxReadRequestUnits ,
|
||||||
|
// MaxWriteRequestUnits , or both.
|
||||||
|
OnDemandThroughput *OnDemandThroughput
|
||||||
|
|
||||||
// Represents attributes that are copied (projected) from the table into the
|
// Represents attributes that are copied (projected) from the table into the
|
||||||
// global secondary index. These are in addition to the primary key attributes and
|
// global secondary index. These are in addition to the primary key attributes and
|
||||||
// index key attributes, which are automatically projected.
|
// index key attributes, which are automatically projected.
|
||||||
|
|
@ -1905,6 +1930,37 @@ type LocalSecondaryIndexInfo struct {
|
||||||
noSmithyDocumentSerde
|
noSmithyDocumentSerde
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sets the maximum number of read and write units for the specified on-demand
|
||||||
|
// table. If you use this parameter, you must specify MaxReadRequestUnits ,
|
||||||
|
// MaxWriteRequestUnits , or both.
|
||||||
|
type OnDemandThroughput struct {
|
||||||
|
|
||||||
|
// Maximum number of read request units for the specified table. To specify a
|
||||||
|
// maximum OnDemandThroughput on your table, set the value of MaxReadRequestUnits
|
||||||
|
// as greater than or equal to 1. To remove the maximum OnDemandThroughput that is
|
||||||
|
// currently set on your table, set the value of MaxReadRequestUnits to -1.
|
||||||
|
MaxReadRequestUnits *int64
|
||||||
|
|
||||||
|
// Maximum number of write request units for the specified table. To specify a
|
||||||
|
// maximum OnDemandThroughput on your table, set the value of MaxWriteRequestUnits
|
||||||
|
// as greater than or equal to 1. To remove the maximum OnDemandThroughput that is
|
||||||
|
// currently set on your table, set the value of MaxWriteRequestUnits to -1.
|
||||||
|
MaxWriteRequestUnits *int64
|
||||||
|
|
||||||
|
noSmithyDocumentSerde
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overrides the on-demand throughput settings for this replica table. If you
|
||||||
|
// don't specify a value for this parameter, it uses the source table's on-demand
|
||||||
|
// throughput settings.
|
||||||
|
type OnDemandThroughputOverride struct {
|
||||||
|
|
||||||
|
// Maximum number of read request units for the specified replica table.
|
||||||
|
MaxReadRequestUnits *int64
|
||||||
|
|
||||||
|
noSmithyDocumentSerde
|
||||||
|
}
|
||||||
|
|
||||||
// Represents a PartiQL statement that uses parameters.
|
// Represents a PartiQL statement that uses parameters.
|
||||||
type ParameterizedStatement struct {
|
type ParameterizedStatement struct {
|
||||||
|
|
||||||
|
|
@ -2161,6 +2217,10 @@ type ReplicaDescription struct {
|
||||||
// The KMS key of the replica that will be used for KMS encryption.
|
// The KMS key of the replica that will be used for KMS encryption.
|
||||||
KMSMasterKeyId *string
|
KMSMasterKeyId *string
|
||||||
|
|
||||||
|
// Overrides the maximum on-demand throughput settings for the specified replica
|
||||||
|
// table.
|
||||||
|
OnDemandThroughputOverride *OnDemandThroughputOverride
|
||||||
|
|
||||||
// Replica-specific provisioned throughput. If not described, uses the source
|
// Replica-specific provisioned throughput. If not described, uses the source
|
||||||
// table's provisioned throughput settings.
|
// table's provisioned throughput settings.
|
||||||
ProvisionedThroughputOverride *ProvisionedThroughputOverride
|
ProvisionedThroughputOverride *ProvisionedThroughputOverride
|
||||||
|
|
@ -2209,6 +2269,10 @@ type ReplicaGlobalSecondaryIndex struct {
|
||||||
// This member is required.
|
// This member is required.
|
||||||
IndexName *string
|
IndexName *string
|
||||||
|
|
||||||
|
// Overrides the maximum on-demand throughput settings for the specified global
|
||||||
|
// secondary index in the specified replica table.
|
||||||
|
OnDemandThroughputOverride *OnDemandThroughputOverride
|
||||||
|
|
||||||
// Replica table GSI-specific provisioned throughput. If not specified, uses the
|
// Replica table GSI-specific provisioned throughput. If not specified, uses the
|
||||||
// source table GSI's read capacity settings.
|
// source table GSI's read capacity settings.
|
||||||
ProvisionedThroughputOverride *ProvisionedThroughputOverride
|
ProvisionedThroughputOverride *ProvisionedThroughputOverride
|
||||||
|
|
@ -2261,6 +2325,10 @@ type ReplicaGlobalSecondaryIndexDescription struct {
|
||||||
// The name of the global secondary index.
|
// The name of the global secondary index.
|
||||||
IndexName *string
|
IndexName *string
|
||||||
|
|
||||||
|
// Overrides the maximum on-demand throughput for the specified global secondary
|
||||||
|
// index in the specified replica table.
|
||||||
|
OnDemandThroughputOverride *OnDemandThroughputOverride
|
||||||
|
|
||||||
// If not described, uses the source table GSI's read capacity settings.
|
// If not described, uses the source table GSI's read capacity settings.
|
||||||
ProvisionedThroughputOverride *ProvisionedThroughputOverride
|
ProvisionedThroughputOverride *ProvisionedThroughputOverride
|
||||||
|
|
||||||
|
|
@ -2516,6 +2584,11 @@ type SourceTableDetails struct {
|
||||||
// Number of items in the table. Note that this is an approximate value.
|
// Number of items in the table. Note that this is an approximate value.
|
||||||
ItemCount *int64
|
ItemCount *int64
|
||||||
|
|
||||||
|
// Sets the maximum number of read and write units for the specified on-demand
|
||||||
|
// table. If you use this parameter, you must specify MaxReadRequestUnits ,
|
||||||
|
// MaxWriteRequestUnits , or both.
|
||||||
|
OnDemandThroughput *OnDemandThroughput
|
||||||
|
|
||||||
// ARN of the table for which backup was created.
|
// ARN of the table for which backup was created.
|
||||||
TableArn *string
|
TableArn *string
|
||||||
|
|
||||||
|
|
@ -2687,6 +2760,11 @@ type TableCreationParameters struct {
|
||||||
// import operation.
|
// import operation.
|
||||||
GlobalSecondaryIndexes []GlobalSecondaryIndex
|
GlobalSecondaryIndexes []GlobalSecondaryIndex
|
||||||
|
|
||||||
|
// Sets the maximum number of read and write units for the specified on-demand
|
||||||
|
// table. If you use this parameter, you must specify MaxReadRequestUnits ,
|
||||||
|
// MaxWriteRequestUnits , or both.
|
||||||
|
OnDemandThroughput *OnDemandThroughput
|
||||||
|
|
||||||
// Represents the provisioned throughput settings for a specified table or index.
|
// Represents the provisioned throughput settings for a specified table or index.
|
||||||
// The settings can be modified using the UpdateTable operation. For current
|
// The settings can be modified using the UpdateTable operation. For current
|
||||||
// minimum and maximum provisioned throughput values, see Service, Account, and
|
// minimum and maximum provisioned throughput values, see Service, Account, and
|
||||||
|
|
@ -2841,6 +2919,11 @@ type TableDescription struct {
|
||||||
// returned.
|
// returned.
|
||||||
LocalSecondaryIndexes []LocalSecondaryIndexDescription
|
LocalSecondaryIndexes []LocalSecondaryIndexDescription
|
||||||
|
|
||||||
|
// The maximum number of read and write units for the specified on-demand table.
|
||||||
|
// If you use this parameter, you must specify MaxReadRequestUnits ,
|
||||||
|
// MaxWriteRequestUnits , or both.
|
||||||
|
OnDemandThroughput *OnDemandThroughput
|
||||||
|
|
||||||
// The provisioned throughput settings for the table, consisting of read and write
|
// The provisioned throughput settings for the table, consisting of read and write
|
||||||
// capacity units, along with data about increases and decreases.
|
// capacity units, along with data about increases and decreases.
|
||||||
ProvisionedThroughput *ProvisionedThroughputDescription
|
ProvisionedThroughput *ProvisionedThroughputDescription
|
||||||
|
|
@ -3027,12 +3110,15 @@ type UpdateGlobalSecondaryIndexAction struct {
|
||||||
// This member is required.
|
// This member is required.
|
||||||
IndexName *string
|
IndexName *string
|
||||||
|
|
||||||
|
// Updates the maximum number of read and write units for the specified global
|
||||||
|
// secondary index. If you use this parameter, you must specify MaxReadRequestUnits
|
||||||
|
// , MaxWriteRequestUnits , or both.
|
||||||
|
OnDemandThroughput *OnDemandThroughput
|
||||||
|
|
||||||
// Represents the provisioned throughput settings for the specified global
|
// Represents the provisioned throughput settings for the specified global
|
||||||
// secondary index. For current minimum and maximum provisioned throughput values,
|
// secondary index. For current minimum and maximum provisioned throughput values,
|
||||||
// see Service, Account, and Table Quotas (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html)
|
// see Service, Account, and Table Quotas (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html)
|
||||||
// in the Amazon DynamoDB Developer Guide.
|
// in the Amazon DynamoDB Developer Guide.
|
||||||
//
|
|
||||||
// This member is required.
|
|
||||||
ProvisionedThroughput *ProvisionedThroughput
|
ProvisionedThroughput *ProvisionedThroughput
|
||||||
|
|
||||||
noSmithyDocumentSerde
|
noSmithyDocumentSerde
|
||||||
|
|
@ -3064,6 +3150,9 @@ type UpdateReplicationGroupMemberAction struct {
|
||||||
// default DynamoDB KMS key alias/aws/dynamodb .
|
// default DynamoDB KMS key alias/aws/dynamodb .
|
||||||
KMSMasterKeyId *string
|
KMSMasterKeyId *string
|
||||||
|
|
||||||
|
// Overrides the maximum on-demand throughput for the replica table.
|
||||||
|
OnDemandThroughputOverride *OnDemandThroughputOverride
|
||||||
|
|
||||||
// Replica-specific provisioned throughput. If not specified, uses the source
|
// Replica-specific provisioned throughput. If not specified, uses the source
|
||||||
// table's provisioned throughput settings.
|
// table's provisioned throughput settings.
|
||||||
ProvisionedThroughputOverride *ProvisionedThroughputOverride
|
ProvisionedThroughputOverride *ProvisionedThroughputOverride
|
||||||
|
|
|
||||||
4
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/validators.go
generated
vendored
4
vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/validators.go
generated
vendored
|
|
@ -2430,9 +2430,7 @@ func validateUpdateGlobalSecondaryIndexAction(v *types.UpdateGlobalSecondaryInde
|
||||||
if v.IndexName == nil {
|
if v.IndexName == nil {
|
||||||
invalidParams.Add(smithy.NewErrParamRequired("IndexName"))
|
invalidParams.Add(smithy.NewErrParamRequired("IndexName"))
|
||||||
}
|
}
|
||||||
if v.ProvisionedThroughput == nil {
|
if v.ProvisionedThroughput != nil {
|
||||||
invalidParams.Add(smithy.NewErrParamRequired("ProvisionedThroughput"))
|
|
||||||
} else if v.ProvisionedThroughput != nil {
|
|
||||||
if err := validateProvisionedThroughput(v.ProvisionedThroughput); err != nil {
|
if err := validateProvisionedThroughput(v.ProvisionedThroughput); err != nil {
|
||||||
invalidParams.AddNested("ProvisionedThroughput", err.(smithy.InvalidParamsError))
|
invalidParams.AddNested("ProvisionedThroughput", err.(smithy.InvalidParamsError))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
vendor/google.golang.org/protobuf/AUTHORS
generated
vendored
3
vendor/google.golang.org/protobuf/AUTHORS
generated
vendored
|
|
@ -1,3 +0,0 @@
|
||||||
# This source code refers to The Go Authors for copyright purposes.
|
|
||||||
# The master list of authors is in the main Go distribution,
|
|
||||||
# visible at https://tip.golang.org/AUTHORS.
|
|
||||||
3
vendor/google.golang.org/protobuf/CONTRIBUTORS
generated
vendored
3
vendor/google.golang.org/protobuf/CONTRIBUTORS
generated
vendored
|
|
@ -1,3 +0,0 @@
|
||||||
# This source code was written by the Go contributors.
|
|
||||||
# The master list of contributors is in the main Go distribution,
|
|
||||||
# visible at https://tip.golang.org/CONTRIBUTORS.
|
|
||||||
127
vendor/google.golang.org/protobuf/encoding/prototext/decode.go
generated
vendored
127
vendor/google.golang.org/protobuf/encoding/prototext/decode.go
generated
vendored
|
|
@ -17,11 +17,11 @@ import (
|
||||||
"google.golang.org/protobuf/internal/set"
|
"google.golang.org/protobuf/internal/set"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Unmarshal reads the given []byte into the given proto.Message.
|
// Unmarshal reads the given []byte into the given [proto.Message].
|
||||||
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
||||||
func Unmarshal(b []byte, m proto.Message) error {
|
func Unmarshal(b []byte, m proto.Message) error {
|
||||||
return UnmarshalOptions{}.Unmarshal(b, m)
|
return UnmarshalOptions{}.Unmarshal(b, m)
|
||||||
|
|
@ -51,7 +51,7 @@ type UnmarshalOptions struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal reads the given []byte and populates the given proto.Message
|
// Unmarshal reads the given []byte and populates the given [proto.Message]
|
||||||
// using options in the UnmarshalOptions object.
|
// using options in the UnmarshalOptions object.
|
||||||
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
||||||
func (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error {
|
func (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error {
|
||||||
|
|
@ -103,7 +103,7 @@ func (d decoder) syntaxError(pos int, f string, x ...interface{}) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// unmarshalMessage unmarshals into the given protoreflect.Message.
|
// unmarshalMessage unmarshals into the given protoreflect.Message.
|
||||||
func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error {
|
func (d decoder) unmarshalMessage(m protoreflect.Message, checkDelims bool) error {
|
||||||
messageDesc := m.Descriptor()
|
messageDesc := m.Descriptor()
|
||||||
if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {
|
if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {
|
||||||
return errors.New("no support for proto1 MessageSets")
|
return errors.New("no support for proto1 MessageSets")
|
||||||
|
|
@ -150,24 +150,24 @@ func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve the field descriptor.
|
// Resolve the field descriptor.
|
||||||
var name pref.Name
|
var name protoreflect.Name
|
||||||
var fd pref.FieldDescriptor
|
var fd protoreflect.FieldDescriptor
|
||||||
var xt pref.ExtensionType
|
var xt protoreflect.ExtensionType
|
||||||
var xtErr error
|
var xtErr error
|
||||||
var isFieldNumberName bool
|
var isFieldNumberName bool
|
||||||
|
|
||||||
switch tok.NameKind() {
|
switch tok.NameKind() {
|
||||||
case text.IdentName:
|
case text.IdentName:
|
||||||
name = pref.Name(tok.IdentName())
|
name = protoreflect.Name(tok.IdentName())
|
||||||
fd = fieldDescs.ByTextName(string(name))
|
fd = fieldDescs.ByTextName(string(name))
|
||||||
|
|
||||||
case text.TypeName:
|
case text.TypeName:
|
||||||
// Handle extensions only. This code path is not for Any.
|
// Handle extensions only. This code path is not for Any.
|
||||||
xt, xtErr = d.opts.Resolver.FindExtensionByName(pref.FullName(tok.TypeName()))
|
xt, xtErr = d.opts.Resolver.FindExtensionByName(protoreflect.FullName(tok.TypeName()))
|
||||||
|
|
||||||
case text.FieldNumber:
|
case text.FieldNumber:
|
||||||
isFieldNumberName = true
|
isFieldNumberName = true
|
||||||
num := pref.FieldNumber(tok.FieldNumber())
|
num := protoreflect.FieldNumber(tok.FieldNumber())
|
||||||
if !num.IsValid() {
|
if !num.IsValid() {
|
||||||
return d.newError(tok.Pos(), "invalid field number: %d", num)
|
return d.newError(tok.Pos(), "invalid field number: %d", num)
|
||||||
}
|
}
|
||||||
|
|
@ -215,7 +215,7 @@ func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error {
|
||||||
switch {
|
switch {
|
||||||
case fd.IsList():
|
case fd.IsList():
|
||||||
kind := fd.Kind()
|
kind := fd.Kind()
|
||||||
if kind != pref.MessageKind && kind != pref.GroupKind && !tok.HasSeparator() {
|
if kind != protoreflect.MessageKind && kind != protoreflect.GroupKind && !tok.HasSeparator() {
|
||||||
return d.syntaxError(tok.Pos(), "missing field separator :")
|
return d.syntaxError(tok.Pos(), "missing field separator :")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -232,7 +232,7 @@ func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error {
|
||||||
|
|
||||||
default:
|
default:
|
||||||
kind := fd.Kind()
|
kind := fd.Kind()
|
||||||
if kind != pref.MessageKind && kind != pref.GroupKind && !tok.HasSeparator() {
|
if kind != protoreflect.MessageKind && kind != protoreflect.GroupKind && !tok.HasSeparator() {
|
||||||
return d.syntaxError(tok.Pos(), "missing field separator :")
|
return d.syntaxError(tok.Pos(), "missing field separator :")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -262,11 +262,11 @@ func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error {
|
||||||
|
|
||||||
// unmarshalSingular unmarshals a non-repeated field value specified by the
|
// unmarshalSingular unmarshals a non-repeated field value specified by the
|
||||||
// given FieldDescriptor.
|
// given FieldDescriptor.
|
||||||
func (d decoder) unmarshalSingular(fd pref.FieldDescriptor, m pref.Message) error {
|
func (d decoder) unmarshalSingular(fd protoreflect.FieldDescriptor, m protoreflect.Message) error {
|
||||||
var val pref.Value
|
var val protoreflect.Value
|
||||||
var err error
|
var err error
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
val = m.NewField(fd)
|
val = m.NewField(fd)
|
||||||
err = d.unmarshalMessage(val.Message(), true)
|
err = d.unmarshalMessage(val.Message(), true)
|
||||||
default:
|
default:
|
||||||
|
|
@ -280,94 +280,94 @@ func (d decoder) unmarshalSingular(fd pref.FieldDescriptor, m pref.Message) erro
|
||||||
|
|
||||||
// unmarshalScalar unmarshals a scalar/enum protoreflect.Value specified by the
|
// unmarshalScalar unmarshals a scalar/enum protoreflect.Value specified by the
|
||||||
// given FieldDescriptor.
|
// given FieldDescriptor.
|
||||||
func (d decoder) unmarshalScalar(fd pref.FieldDescriptor) (pref.Value, error) {
|
func (d decoder) unmarshalScalar(fd protoreflect.FieldDescriptor) (protoreflect.Value, error) {
|
||||||
tok, err := d.Read()
|
tok, err := d.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pref.Value{}, err
|
return protoreflect.Value{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if tok.Kind() != text.Scalar {
|
if tok.Kind() != text.Scalar {
|
||||||
return pref.Value{}, d.unexpectedTokenError(tok)
|
return protoreflect.Value{}, d.unexpectedTokenError(tok)
|
||||||
}
|
}
|
||||||
|
|
||||||
kind := fd.Kind()
|
kind := fd.Kind()
|
||||||
switch kind {
|
switch kind {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if b, ok := tok.Bool(); ok {
|
if b, ok := tok.Bool(); ok {
|
||||||
return pref.ValueOfBool(b), nil
|
return protoreflect.ValueOfBool(b), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||||
if n, ok := tok.Int32(); ok {
|
if n, ok := tok.Int32(); ok {
|
||||||
return pref.ValueOfInt32(n), nil
|
return protoreflect.ValueOfInt32(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||||
if n, ok := tok.Int64(); ok {
|
if n, ok := tok.Int64(); ok {
|
||||||
return pref.ValueOfInt64(n), nil
|
return protoreflect.ValueOfInt64(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||||
if n, ok := tok.Uint32(); ok {
|
if n, ok := tok.Uint32(); ok {
|
||||||
return pref.ValueOfUint32(n), nil
|
return protoreflect.ValueOfUint32(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Uint64Kind, pref.Fixed64Kind:
|
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||||
if n, ok := tok.Uint64(); ok {
|
if n, ok := tok.Uint64(); ok {
|
||||||
return pref.ValueOfUint64(n), nil
|
return protoreflect.ValueOfUint64(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if n, ok := tok.Float32(); ok {
|
if n, ok := tok.Float32(); ok {
|
||||||
return pref.ValueOfFloat32(n), nil
|
return protoreflect.ValueOfFloat32(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if n, ok := tok.Float64(); ok {
|
if n, ok := tok.Float64(); ok {
|
||||||
return pref.ValueOfFloat64(n), nil
|
return protoreflect.ValueOfFloat64(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if s, ok := tok.String(); ok {
|
if s, ok := tok.String(); ok {
|
||||||
if strs.EnforceUTF8(fd) && !utf8.ValidString(s) {
|
if strs.EnforceUTF8(fd) && !utf8.ValidString(s) {
|
||||||
return pref.Value{}, d.newError(tok.Pos(), "contains invalid UTF-8")
|
return protoreflect.Value{}, d.newError(tok.Pos(), "contains invalid UTF-8")
|
||||||
}
|
}
|
||||||
return pref.ValueOfString(s), nil
|
return protoreflect.ValueOfString(s), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if b, ok := tok.String(); ok {
|
if b, ok := tok.String(); ok {
|
||||||
return pref.ValueOfBytes([]byte(b)), nil
|
return protoreflect.ValueOfBytes([]byte(b)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if lit, ok := tok.Enum(); ok {
|
if lit, ok := tok.Enum(); ok {
|
||||||
// Lookup EnumNumber based on name.
|
// Lookup EnumNumber based on name.
|
||||||
if enumVal := fd.Enum().Values().ByName(pref.Name(lit)); enumVal != nil {
|
if enumVal := fd.Enum().Values().ByName(protoreflect.Name(lit)); enumVal != nil {
|
||||||
return pref.ValueOfEnum(enumVal.Number()), nil
|
return protoreflect.ValueOfEnum(enumVal.Number()), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if num, ok := tok.Int32(); ok {
|
if num, ok := tok.Int32(); ok {
|
||||||
return pref.ValueOfEnum(pref.EnumNumber(num)), nil
|
return protoreflect.ValueOfEnum(protoreflect.EnumNumber(num)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("invalid scalar kind %v", kind))
|
panic(fmt.Sprintf("invalid scalar kind %v", kind))
|
||||||
}
|
}
|
||||||
|
|
||||||
return pref.Value{}, d.newError(tok.Pos(), "invalid value for %v type: %v", kind, tok.RawString())
|
return protoreflect.Value{}, d.newError(tok.Pos(), "invalid value for %v type: %v", kind, tok.RawString())
|
||||||
}
|
}
|
||||||
|
|
||||||
// unmarshalList unmarshals into given protoreflect.List. A list value can
|
// unmarshalList unmarshals into given protoreflect.List. A list value can
|
||||||
// either be in [] syntax or simply just a single scalar/message value.
|
// either be in [] syntax or simply just a single scalar/message value.
|
||||||
func (d decoder) unmarshalList(fd pref.FieldDescriptor, list pref.List) error {
|
func (d decoder) unmarshalList(fd protoreflect.FieldDescriptor, list protoreflect.List) error {
|
||||||
tok, err := d.Peek()
|
tok, err := d.Peek()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
switch tok.Kind() {
|
switch tok.Kind() {
|
||||||
case text.ListOpen:
|
case text.ListOpen:
|
||||||
d.Read()
|
d.Read()
|
||||||
|
|
@ -441,22 +441,22 @@ func (d decoder) unmarshalList(fd pref.FieldDescriptor, list pref.List) error {
|
||||||
|
|
||||||
// unmarshalMap unmarshals into given protoreflect.Map. A map value is a
|
// unmarshalMap unmarshals into given protoreflect.Map. A map value is a
|
||||||
// textproto message containing {key: <kvalue>, value: <mvalue>}.
|
// textproto message containing {key: <kvalue>, value: <mvalue>}.
|
||||||
func (d decoder) unmarshalMap(fd pref.FieldDescriptor, mmap pref.Map) error {
|
func (d decoder) unmarshalMap(fd protoreflect.FieldDescriptor, mmap protoreflect.Map) error {
|
||||||
// Determine ahead whether map entry is a scalar type or a message type in
|
// Determine ahead whether map entry is a scalar type or a message type in
|
||||||
// order to call the appropriate unmarshalMapValue func inside
|
// order to call the appropriate unmarshalMapValue func inside
|
||||||
// unmarshalMapEntry.
|
// unmarshalMapEntry.
|
||||||
var unmarshalMapValue func() (pref.Value, error)
|
var unmarshalMapValue func() (protoreflect.Value, error)
|
||||||
switch fd.MapValue().Kind() {
|
switch fd.MapValue().Kind() {
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
unmarshalMapValue = func() (pref.Value, error) {
|
unmarshalMapValue = func() (protoreflect.Value, error) {
|
||||||
pval := mmap.NewValue()
|
pval := mmap.NewValue()
|
||||||
if err := d.unmarshalMessage(pval.Message(), true); err != nil {
|
if err := d.unmarshalMessage(pval.Message(), true); err != nil {
|
||||||
return pref.Value{}, err
|
return protoreflect.Value{}, err
|
||||||
}
|
}
|
||||||
return pval, nil
|
return pval, nil
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
unmarshalMapValue = func() (pref.Value, error) {
|
unmarshalMapValue = func() (protoreflect.Value, error) {
|
||||||
return d.unmarshalScalar(fd.MapValue())
|
return d.unmarshalScalar(fd.MapValue())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -494,9 +494,9 @@ func (d decoder) unmarshalMap(fd pref.FieldDescriptor, mmap pref.Map) error {
|
||||||
|
|
||||||
// unmarshalMap unmarshals into given protoreflect.Map. A map value is a
|
// unmarshalMap unmarshals into given protoreflect.Map. A map value is a
|
||||||
// textproto message containing {key: <kvalue>, value: <mvalue>}.
|
// textproto message containing {key: <kvalue>, value: <mvalue>}.
|
||||||
func (d decoder) unmarshalMapEntry(fd pref.FieldDescriptor, mmap pref.Map, unmarshalMapValue func() (pref.Value, error)) error {
|
func (d decoder) unmarshalMapEntry(fd protoreflect.FieldDescriptor, mmap protoreflect.Map, unmarshalMapValue func() (protoreflect.Value, error)) error {
|
||||||
var key pref.MapKey
|
var key protoreflect.MapKey
|
||||||
var pval pref.Value
|
var pval protoreflect.Value
|
||||||
Loop:
|
Loop:
|
||||||
for {
|
for {
|
||||||
// Read field name.
|
// Read field name.
|
||||||
|
|
@ -520,7 +520,7 @@ Loop:
|
||||||
return d.unexpectedTokenError(tok)
|
return d.unexpectedTokenError(tok)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch name := pref.Name(tok.IdentName()); name {
|
switch name := protoreflect.Name(tok.IdentName()); name {
|
||||||
case genid.MapEntry_Key_field_name:
|
case genid.MapEntry_Key_field_name:
|
||||||
if !tok.HasSeparator() {
|
if !tok.HasSeparator() {
|
||||||
return d.syntaxError(tok.Pos(), "missing field separator :")
|
return d.syntaxError(tok.Pos(), "missing field separator :")
|
||||||
|
|
@ -535,7 +535,7 @@ Loop:
|
||||||
key = val.MapKey()
|
key = val.MapKey()
|
||||||
|
|
||||||
case genid.MapEntry_Value_field_name:
|
case genid.MapEntry_Value_field_name:
|
||||||
if kind := fd.MapValue().Kind(); (kind != pref.MessageKind) && (kind != pref.GroupKind) {
|
if kind := fd.MapValue().Kind(); (kind != protoreflect.MessageKind) && (kind != protoreflect.GroupKind) {
|
||||||
if !tok.HasSeparator() {
|
if !tok.HasSeparator() {
|
||||||
return d.syntaxError(tok.Pos(), "missing field separator :")
|
return d.syntaxError(tok.Pos(), "missing field separator :")
|
||||||
}
|
}
|
||||||
|
|
@ -561,7 +561,7 @@ Loop:
|
||||||
}
|
}
|
||||||
if !pval.IsValid() {
|
if !pval.IsValid() {
|
||||||
switch fd.MapValue().Kind() {
|
switch fd.MapValue().Kind() {
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
// If value field is not set for message/group types, construct an
|
// If value field is not set for message/group types, construct an
|
||||||
// empty one as default.
|
// empty one as default.
|
||||||
pval = mmap.NewValue()
|
pval = mmap.NewValue()
|
||||||
|
|
@ -575,7 +575,7 @@ Loop:
|
||||||
|
|
||||||
// unmarshalAny unmarshals an Any textproto. It can either be in expanded form
|
// unmarshalAny unmarshals an Any textproto. It can either be in expanded form
|
||||||
// or non-expanded form.
|
// or non-expanded form.
|
||||||
func (d decoder) unmarshalAny(m pref.Message, checkDelims bool) error {
|
func (d decoder) unmarshalAny(m protoreflect.Message, checkDelims bool) error {
|
||||||
var typeURL string
|
var typeURL string
|
||||||
var bValue []byte
|
var bValue []byte
|
||||||
var seenTypeUrl bool
|
var seenTypeUrl bool
|
||||||
|
|
@ -619,7 +619,7 @@ Loop:
|
||||||
return d.syntaxError(tok.Pos(), "missing field separator :")
|
return d.syntaxError(tok.Pos(), "missing field separator :")
|
||||||
}
|
}
|
||||||
|
|
||||||
switch name := pref.Name(tok.IdentName()); name {
|
switch name := protoreflect.Name(tok.IdentName()); name {
|
||||||
case genid.Any_TypeUrl_field_name:
|
case genid.Any_TypeUrl_field_name:
|
||||||
if seenTypeUrl {
|
if seenTypeUrl {
|
||||||
return d.newError(tok.Pos(), "duplicate %v field", genid.Any_TypeUrl_field_fullname)
|
return d.newError(tok.Pos(), "duplicate %v field", genid.Any_TypeUrl_field_fullname)
|
||||||
|
|
@ -686,10 +686,10 @@ Loop:
|
||||||
|
|
||||||
fds := m.Descriptor().Fields()
|
fds := m.Descriptor().Fields()
|
||||||
if len(typeURL) > 0 {
|
if len(typeURL) > 0 {
|
||||||
m.Set(fds.ByNumber(genid.Any_TypeUrl_field_number), pref.ValueOfString(typeURL))
|
m.Set(fds.ByNumber(genid.Any_TypeUrl_field_number), protoreflect.ValueOfString(typeURL))
|
||||||
}
|
}
|
||||||
if len(bValue) > 0 {
|
if len(bValue) > 0 {
|
||||||
m.Set(fds.ByNumber(genid.Any_Value_field_number), pref.ValueOfBytes(bValue))
|
m.Set(fds.ByNumber(genid.Any_Value_field_number), protoreflect.ValueOfBytes(bValue))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -739,14 +739,13 @@ func (d decoder) skipValue() error {
|
||||||
case text.ListClose:
|
case text.ListClose:
|
||||||
return nil
|
return nil
|
||||||
case text.MessageOpen:
|
case text.MessageOpen:
|
||||||
return d.skipMessageValue()
|
if err := d.skipMessageValue(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
// Skip items. This will not validate whether skipped values are
|
// Skip items. This will not validate whether skipped values are
|
||||||
// of the same type or not, same behavior as C++
|
// of the same type or not, same behavior as C++
|
||||||
// TextFormat::Parser::AllowUnknownField(true) version 3.8.0.
|
// TextFormat::Parser::AllowUnknownField(true) version 3.8.0.
|
||||||
if err := d.skipValue(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
77
vendor/google.golang.org/protobuf/encoding/prototext/encode.go
generated
vendored
77
vendor/google.golang.org/protobuf/encoding/prototext/encode.go
generated
vendored
|
|
@ -20,7 +20,6 @@ import (
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -28,15 +27,17 @@ const defaultIndent = " "
|
||||||
|
|
||||||
// Format formats the message as a multiline string.
|
// Format formats the message as a multiline string.
|
||||||
// This function is only intended for human consumption and ignores errors.
|
// This function is only intended for human consumption and ignores errors.
|
||||||
// Do not depend on the output being stable. It may change over time across
|
// Do not depend on the output being stable. Its output will change across
|
||||||
// different versions of the program.
|
// different builds of your program, even when using the same version of the
|
||||||
|
// protobuf module.
|
||||||
func Format(m proto.Message) string {
|
func Format(m proto.Message) string {
|
||||||
return MarshalOptions{Multiline: true}.Format(m)
|
return MarshalOptions{Multiline: true}.Format(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal writes the given proto.Message in textproto format using default
|
// Marshal writes the given [proto.Message] in textproto format using default
|
||||||
// options. Do not depend on the output being stable. It may change over time
|
// options. Do not depend on the output being stable. Its output will change
|
||||||
// across different versions of the program.
|
// across different builds of your program, even when using the same version of
|
||||||
|
// the protobuf module.
|
||||||
func Marshal(m proto.Message) ([]byte, error) {
|
func Marshal(m proto.Message) ([]byte, error) {
|
||||||
return MarshalOptions{}.Marshal(m)
|
return MarshalOptions{}.Marshal(m)
|
||||||
}
|
}
|
||||||
|
|
@ -85,8 +86,9 @@ type MarshalOptions struct {
|
||||||
|
|
||||||
// Format formats the message as a string.
|
// Format formats the message as a string.
|
||||||
// This method is only intended for human consumption and ignores errors.
|
// This method is only intended for human consumption and ignores errors.
|
||||||
// Do not depend on the output being stable. It may change over time across
|
// Do not depend on the output being stable. Its output will change across
|
||||||
// different versions of the program.
|
// different builds of your program, even when using the same version of the
|
||||||
|
// protobuf module.
|
||||||
func (o MarshalOptions) Format(m proto.Message) string {
|
func (o MarshalOptions) Format(m proto.Message) string {
|
||||||
if m == nil || !m.ProtoReflect().IsValid() {
|
if m == nil || !m.ProtoReflect().IsValid() {
|
||||||
return "<nil>" // invalid syntax, but okay since this is for debugging
|
return "<nil>" // invalid syntax, but okay since this is for debugging
|
||||||
|
|
@ -98,17 +100,24 @@ func (o MarshalOptions) Format(m proto.Message) string {
|
||||||
return string(b)
|
return string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal writes the given proto.Message in textproto format using options in
|
// Marshal writes the given [proto.Message] in textproto format using options in
|
||||||
// MarshalOptions object. Do not depend on the output being stable. It may
|
// MarshalOptions object. Do not depend on the output being stable. Its output
|
||||||
// change over time across different versions of the program.
|
// will change across different builds of your program, even when using the
|
||||||
|
// same version of the protobuf module.
|
||||||
func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {
|
func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {
|
||||||
return o.marshal(m)
|
return o.marshal(nil, m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalAppend appends the textproto format encoding of m to b,
|
||||||
|
// returning the result.
|
||||||
|
func (o MarshalOptions) MarshalAppend(b []byte, m proto.Message) ([]byte, error) {
|
||||||
|
return o.marshal(b, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// marshal is a centralized function that all marshal operations go through.
|
// marshal is a centralized function that all marshal operations go through.
|
||||||
// For profiling purposes, avoid changing the name of this function or
|
// For profiling purposes, avoid changing the name of this function or
|
||||||
// introducing other code paths for marshal that do not go through this.
|
// introducing other code paths for marshal that do not go through this.
|
||||||
func (o MarshalOptions) marshal(m proto.Message) ([]byte, error) {
|
func (o MarshalOptions) marshal(b []byte, m proto.Message) ([]byte, error) {
|
||||||
var delims = [2]byte{'{', '}'}
|
var delims = [2]byte{'{', '}'}
|
||||||
|
|
||||||
if o.Multiline && o.Indent == "" {
|
if o.Multiline && o.Indent == "" {
|
||||||
|
|
@ -118,7 +127,7 @@ func (o MarshalOptions) marshal(m proto.Message) ([]byte, error) {
|
||||||
o.Resolver = protoregistry.GlobalTypes
|
o.Resolver = protoregistry.GlobalTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
internalEnc, err := text.NewEncoder(o.Indent, delims, o.EmitASCII)
|
internalEnc, err := text.NewEncoder(b, o.Indent, delims, o.EmitASCII)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -126,7 +135,7 @@ func (o MarshalOptions) marshal(m proto.Message) ([]byte, error) {
|
||||||
// Treat nil message interface as an empty message,
|
// Treat nil message interface as an empty message,
|
||||||
// in which case there is nothing to output.
|
// in which case there is nothing to output.
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return []byte{}, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
enc := encoder{internalEnc, o}
|
enc := encoder{internalEnc, o}
|
||||||
|
|
@ -150,7 +159,7 @@ type encoder struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// marshalMessage marshals the given protoreflect.Message.
|
// marshalMessage marshals the given protoreflect.Message.
|
||||||
func (e encoder) marshalMessage(m pref.Message, inclDelims bool) error {
|
func (e encoder) marshalMessage(m protoreflect.Message, inclDelims bool) error {
|
||||||
messageDesc := m.Descriptor()
|
messageDesc := m.Descriptor()
|
||||||
if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {
|
if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {
|
||||||
return errors.New("no support for proto1 MessageSets")
|
return errors.New("no support for proto1 MessageSets")
|
||||||
|
|
@ -190,7 +199,7 @@ func (e encoder) marshalMessage(m pref.Message, inclDelims bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// marshalField marshals the given field with protoreflect.Value.
|
// marshalField marshals the given field with protoreflect.Value.
|
||||||
func (e encoder) marshalField(name string, val pref.Value, fd pref.FieldDescriptor) error {
|
func (e encoder) marshalField(name string, val protoreflect.Value, fd protoreflect.FieldDescriptor) error {
|
||||||
switch {
|
switch {
|
||||||
case fd.IsList():
|
case fd.IsList():
|
||||||
return e.marshalList(name, val.List(), fd)
|
return e.marshalList(name, val.List(), fd)
|
||||||
|
|
@ -204,40 +213,40 @@ func (e encoder) marshalField(name string, val pref.Value, fd pref.FieldDescript
|
||||||
|
|
||||||
// marshalSingular marshals the given non-repeated field value. This includes
|
// marshalSingular marshals the given non-repeated field value. This includes
|
||||||
// all scalar types, enums, messages, and groups.
|
// all scalar types, enums, messages, and groups.
|
||||||
func (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error {
|
func (e encoder) marshalSingular(val protoreflect.Value, fd protoreflect.FieldDescriptor) error {
|
||||||
kind := fd.Kind()
|
kind := fd.Kind()
|
||||||
switch kind {
|
switch kind {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
e.WriteBool(val.Bool())
|
e.WriteBool(val.Bool())
|
||||||
|
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
s := val.String()
|
s := val.String()
|
||||||
if !e.opts.allowInvalidUTF8 && strs.EnforceUTF8(fd) && !utf8.ValidString(s) {
|
if !e.opts.allowInvalidUTF8 && strs.EnforceUTF8(fd) && !utf8.ValidString(s) {
|
||||||
return errors.InvalidUTF8(string(fd.FullName()))
|
return errors.InvalidUTF8(string(fd.FullName()))
|
||||||
}
|
}
|
||||||
e.WriteString(s)
|
e.WriteString(s)
|
||||||
|
|
||||||
case pref.Int32Kind, pref.Int64Kind,
|
case protoreflect.Int32Kind, protoreflect.Int64Kind,
|
||||||
pref.Sint32Kind, pref.Sint64Kind,
|
protoreflect.Sint32Kind, protoreflect.Sint64Kind,
|
||||||
pref.Sfixed32Kind, pref.Sfixed64Kind:
|
protoreflect.Sfixed32Kind, protoreflect.Sfixed64Kind:
|
||||||
e.WriteInt(val.Int())
|
e.WriteInt(val.Int())
|
||||||
|
|
||||||
case pref.Uint32Kind, pref.Uint64Kind,
|
case protoreflect.Uint32Kind, protoreflect.Uint64Kind,
|
||||||
pref.Fixed32Kind, pref.Fixed64Kind:
|
protoreflect.Fixed32Kind, protoreflect.Fixed64Kind:
|
||||||
e.WriteUint(val.Uint())
|
e.WriteUint(val.Uint())
|
||||||
|
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
// Encoder.WriteFloat handles the special numbers NaN and infinites.
|
// Encoder.WriteFloat handles the special numbers NaN and infinites.
|
||||||
e.WriteFloat(val.Float(), 32)
|
e.WriteFloat(val.Float(), 32)
|
||||||
|
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
// Encoder.WriteFloat handles the special numbers NaN and infinites.
|
// Encoder.WriteFloat handles the special numbers NaN and infinites.
|
||||||
e.WriteFloat(val.Float(), 64)
|
e.WriteFloat(val.Float(), 64)
|
||||||
|
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
e.WriteString(string(val.Bytes()))
|
e.WriteString(string(val.Bytes()))
|
||||||
|
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
num := val.Enum()
|
num := val.Enum()
|
||||||
if desc := fd.Enum().Values().ByNumber(num); desc != nil {
|
if desc := fd.Enum().Values().ByNumber(num); desc != nil {
|
||||||
e.WriteLiteral(string(desc.Name()))
|
e.WriteLiteral(string(desc.Name()))
|
||||||
|
|
@ -246,7 +255,7 @@ func (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error
|
||||||
e.WriteInt(int64(num))
|
e.WriteInt(int64(num))
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
return e.marshalMessage(val.Message(), true)
|
return e.marshalMessage(val.Message(), true)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -256,7 +265,7 @@ func (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// marshalList marshals the given protoreflect.List as multiple name-value fields.
|
// marshalList marshals the given protoreflect.List as multiple name-value fields.
|
||||||
func (e encoder) marshalList(name string, list pref.List, fd pref.FieldDescriptor) error {
|
func (e encoder) marshalList(name string, list protoreflect.List, fd protoreflect.FieldDescriptor) error {
|
||||||
size := list.Len()
|
size := list.Len()
|
||||||
for i := 0; i < size; i++ {
|
for i := 0; i < size; i++ {
|
||||||
e.WriteName(name)
|
e.WriteName(name)
|
||||||
|
|
@ -268,9 +277,9 @@ func (e encoder) marshalList(name string, list pref.List, fd pref.FieldDescripto
|
||||||
}
|
}
|
||||||
|
|
||||||
// marshalMap marshals the given protoreflect.Map as multiple name-value fields.
|
// marshalMap marshals the given protoreflect.Map as multiple name-value fields.
|
||||||
func (e encoder) marshalMap(name string, mmap pref.Map, fd pref.FieldDescriptor) error {
|
func (e encoder) marshalMap(name string, mmap protoreflect.Map, fd protoreflect.FieldDescriptor) error {
|
||||||
var err error
|
var err error
|
||||||
order.RangeEntries(mmap, order.GenericKeyOrder, func(key pref.MapKey, val pref.Value) bool {
|
order.RangeEntries(mmap, order.GenericKeyOrder, func(key protoreflect.MapKey, val protoreflect.Value) bool {
|
||||||
e.WriteName(name)
|
e.WriteName(name)
|
||||||
e.StartMessage()
|
e.StartMessage()
|
||||||
defer e.EndMessage()
|
defer e.EndMessage()
|
||||||
|
|
@ -334,7 +343,7 @@ func (e encoder) marshalUnknown(b []byte) {
|
||||||
|
|
||||||
// marshalAny marshals the given google.protobuf.Any message in expanded form.
|
// marshalAny marshals the given google.protobuf.Any message in expanded form.
|
||||||
// It returns true if it was able to marshal, else false.
|
// It returns true if it was able to marshal, else false.
|
||||||
func (e encoder) marshalAny(any pref.Message) bool {
|
func (e encoder) marshalAny(any protoreflect.Message) bool {
|
||||||
// Construct the embedded message.
|
// Construct the embedded message.
|
||||||
fds := any.Descriptor().Fields()
|
fds := any.Descriptor().Fields()
|
||||||
fdType := fds.ByNumber(genid.Any_TypeUrl_field_number)
|
fdType := fds.ByNumber(genid.Any_TypeUrl_field_number)
|
||||||
|
|
|
||||||
59
vendor/google.golang.org/protobuf/encoding/protowire/wire.go
generated
vendored
59
vendor/google.golang.org/protobuf/encoding/protowire/wire.go
generated
vendored
|
|
@ -3,10 +3,10 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Package protowire parses and formats the raw wire encoding.
|
// Package protowire parses and formats the raw wire encoding.
|
||||||
// See https://developers.google.com/protocol-buffers/docs/encoding.
|
// See https://protobuf.dev/programming-guides/encoding.
|
||||||
//
|
//
|
||||||
// For marshaling and unmarshaling entire protobuf messages,
|
// For marshaling and unmarshaling entire protobuf messages,
|
||||||
// use the "google.golang.org/protobuf/proto" package instead.
|
// use the [google.golang.org/protobuf/proto] package instead.
|
||||||
package protowire
|
package protowire
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
@ -21,19 +21,16 @@ import (
|
||||||
type Number int32
|
type Number int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MinValidNumber Number = 1
|
MinValidNumber Number = 1
|
||||||
FirstReservedNumber Number = 19000
|
FirstReservedNumber Number = 19000
|
||||||
LastReservedNumber Number = 19999
|
LastReservedNumber Number = 19999
|
||||||
MaxValidNumber Number = 1<<29 - 1
|
MaxValidNumber Number = 1<<29 - 1
|
||||||
|
DefaultRecursionLimit = 10000
|
||||||
)
|
)
|
||||||
|
|
||||||
// IsValid reports whether the field number is semantically valid.
|
// IsValid reports whether the field number is semantically valid.
|
||||||
//
|
|
||||||
// Note that while numbers within the reserved range are semantically invalid,
|
|
||||||
// they are syntactically valid in the wire format.
|
|
||||||
// Implementations may treat records with reserved field numbers as unknown.
|
|
||||||
func (n Number) IsValid() bool {
|
func (n Number) IsValid() bool {
|
||||||
return MinValidNumber <= n && n < FirstReservedNumber || LastReservedNumber < n && n <= MaxValidNumber
|
return MinValidNumber <= n && n <= MaxValidNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type represents the wire type.
|
// Type represents the wire type.
|
||||||
|
|
@ -55,6 +52,7 @@ const (
|
||||||
errCodeOverflow
|
errCodeOverflow
|
||||||
errCodeReserved
|
errCodeReserved
|
||||||
errCodeEndGroup
|
errCodeEndGroup
|
||||||
|
errCodeRecursionDepth
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -89,7 +87,7 @@ func ParseError(n int) error {
|
||||||
|
|
||||||
// ConsumeField parses an entire field record (both tag and value) and returns
|
// ConsumeField parses an entire field record (both tag and value) and returns
|
||||||
// the field number, the wire type, and the total length.
|
// the field number, the wire type, and the total length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
//
|
//
|
||||||
// The total length includes the tag header and the end group marker (if the
|
// The total length includes the tag header and the end group marker (if the
|
||||||
// field is a group).
|
// field is a group).
|
||||||
|
|
@ -106,12 +104,16 @@ func ConsumeField(b []byte) (Number, Type, int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeFieldValue parses a field value and returns its length.
|
// ConsumeFieldValue parses a field value and returns its length.
|
||||||
// This assumes that the field Number and wire Type have already been parsed.
|
// This assumes that the field [Number] and wire [Type] have already been parsed.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
//
|
//
|
||||||
// When parsing a group, the length includes the end group marker and
|
// When parsing a group, the length includes the end group marker and
|
||||||
// the end group is verified to match the starting field number.
|
// the end group is verified to match the starting field number.
|
||||||
func ConsumeFieldValue(num Number, typ Type, b []byte) (n int) {
|
func ConsumeFieldValue(num Number, typ Type, b []byte) (n int) {
|
||||||
|
return consumeFieldValueD(num, typ, b, DefaultRecursionLimit)
|
||||||
|
}
|
||||||
|
|
||||||
|
func consumeFieldValueD(num Number, typ Type, b []byte, depth int) (n int) {
|
||||||
switch typ {
|
switch typ {
|
||||||
case VarintType:
|
case VarintType:
|
||||||
_, n = ConsumeVarint(b)
|
_, n = ConsumeVarint(b)
|
||||||
|
|
@ -126,6 +128,9 @@ func ConsumeFieldValue(num Number, typ Type, b []byte) (n int) {
|
||||||
_, n = ConsumeBytes(b)
|
_, n = ConsumeBytes(b)
|
||||||
return n
|
return n
|
||||||
case StartGroupType:
|
case StartGroupType:
|
||||||
|
if depth < 0 {
|
||||||
|
return errCodeRecursionDepth
|
||||||
|
}
|
||||||
n0 := len(b)
|
n0 := len(b)
|
||||||
for {
|
for {
|
||||||
num2, typ2, n := ConsumeTag(b)
|
num2, typ2, n := ConsumeTag(b)
|
||||||
|
|
@ -140,7 +145,7 @@ func ConsumeFieldValue(num Number, typ Type, b []byte) (n int) {
|
||||||
return n0 - len(b)
|
return n0 - len(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
n = ConsumeFieldValue(num2, typ2, b)
|
n = consumeFieldValueD(num2, typ2, b, depth-1)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return n // forward error code
|
return n // forward error code
|
||||||
}
|
}
|
||||||
|
|
@ -159,7 +164,7 @@ func AppendTag(b []byte, num Number, typ Type) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeTag parses b as a varint-encoded tag, reporting its length.
|
// ConsumeTag parses b as a varint-encoded tag, reporting its length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeTag(b []byte) (Number, Type, int) {
|
func ConsumeTag(b []byte) (Number, Type, int) {
|
||||||
v, n := ConsumeVarint(b)
|
v, n := ConsumeVarint(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
|
@ -258,7 +263,7 @@ func AppendVarint(b []byte, v uint64) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeVarint parses b as a varint-encoded uint64, reporting its length.
|
// ConsumeVarint parses b as a varint-encoded uint64, reporting its length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeVarint(b []byte) (v uint64, n int) {
|
func ConsumeVarint(b []byte) (v uint64, n int) {
|
||||||
var y uint64
|
var y uint64
|
||||||
if len(b) <= 0 {
|
if len(b) <= 0 {
|
||||||
|
|
@ -379,7 +384,7 @@ func AppendFixed32(b []byte, v uint32) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeFixed32 parses b as a little-endian uint32, reporting its length.
|
// ConsumeFixed32 parses b as a little-endian uint32, reporting its length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeFixed32(b []byte) (v uint32, n int) {
|
func ConsumeFixed32(b []byte) (v uint32, n int) {
|
||||||
if len(b) < 4 {
|
if len(b) < 4 {
|
||||||
return 0, errCodeTruncated
|
return 0, errCodeTruncated
|
||||||
|
|
@ -407,7 +412,7 @@ func AppendFixed64(b []byte, v uint64) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeFixed64 parses b as a little-endian uint64, reporting its length.
|
// ConsumeFixed64 parses b as a little-endian uint64, reporting its length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeFixed64(b []byte) (v uint64, n int) {
|
func ConsumeFixed64(b []byte) (v uint64, n int) {
|
||||||
if len(b) < 8 {
|
if len(b) < 8 {
|
||||||
return 0, errCodeTruncated
|
return 0, errCodeTruncated
|
||||||
|
|
@ -427,7 +432,7 @@ func AppendBytes(b []byte, v []byte) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeBytes parses b as a length-prefixed bytes value, reporting its length.
|
// ConsumeBytes parses b as a length-prefixed bytes value, reporting its length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeBytes(b []byte) (v []byte, n int) {
|
func ConsumeBytes(b []byte) (v []byte, n int) {
|
||||||
m, n := ConsumeVarint(b)
|
m, n := ConsumeVarint(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
|
@ -451,7 +456,7 @@ func AppendString(b []byte, v string) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeString parses b as a length-prefixed bytes value, reporting its length.
|
// ConsumeString parses b as a length-prefixed bytes value, reporting its length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeString(b []byte) (v string, n int) {
|
func ConsumeString(b []byte) (v string, n int) {
|
||||||
bb, n := ConsumeBytes(b)
|
bb, n := ConsumeBytes(b)
|
||||||
return string(bb), n
|
return string(bb), n
|
||||||
|
|
@ -466,7 +471,7 @@ func AppendGroup(b []byte, num Number, v []byte) []byte {
|
||||||
// ConsumeGroup parses b as a group value until the trailing end group marker,
|
// ConsumeGroup parses b as a group value until the trailing end group marker,
|
||||||
// and verifies that the end marker matches the provided num. The value v
|
// and verifies that the end marker matches the provided num. The value v
|
||||||
// does not contain the end marker, while the length does contain the end marker.
|
// does not contain the end marker, while the length does contain the end marker.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeGroup(num Number, b []byte) (v []byte, n int) {
|
func ConsumeGroup(num Number, b []byte) (v []byte, n int) {
|
||||||
n = ConsumeFieldValue(num, StartGroupType, b)
|
n = ConsumeFieldValue(num, StartGroupType, b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
|
@ -490,8 +495,8 @@ func SizeGroup(num Number, n int) int {
|
||||||
return n + SizeTag(num)
|
return n + SizeTag(num)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeTag decodes the field Number and wire Type from its unified form.
|
// DecodeTag decodes the field [Number] and wire [Type] from its unified form.
|
||||||
// The Number is -1 if the decoded field number overflows int32.
|
// The [Number] is -1 if the decoded field number overflows int32.
|
||||||
// Other than overflow, this does not check for field number validity.
|
// Other than overflow, this does not check for field number validity.
|
||||||
func DecodeTag(x uint64) (Number, Type) {
|
func DecodeTag(x uint64) (Number, Type) {
|
||||||
// NOTE: MessageSet allows for larger field numbers than normal.
|
// NOTE: MessageSet allows for larger field numbers than normal.
|
||||||
|
|
@ -501,12 +506,13 @@ func DecodeTag(x uint64) (Number, Type) {
|
||||||
return Number(x >> 3), Type(x & 7)
|
return Number(x >> 3), Type(x & 7)
|
||||||
}
|
}
|
||||||
|
|
||||||
// EncodeTag encodes the field Number and wire Type into its unified form.
|
// EncodeTag encodes the field [Number] and wire [Type] into its unified form.
|
||||||
func EncodeTag(num Number, typ Type) uint64 {
|
func EncodeTag(num Number, typ Type) uint64 {
|
||||||
return uint64(num)<<3 | uint64(typ&7)
|
return uint64(num)<<3 | uint64(typ&7)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeZigZag decodes a zig-zag-encoded uint64 as an int64.
|
// DecodeZigZag decodes a zig-zag-encoded uint64 as an int64.
|
||||||
|
//
|
||||||
// Input: {…, 5, 3, 1, 0, 2, 4, 6, …}
|
// Input: {…, 5, 3, 1, 0, 2, 4, 6, …}
|
||||||
// Output: {…, -3, -2, -1, 0, +1, +2, +3, …}
|
// Output: {…, -3, -2, -1, 0, +1, +2, +3, …}
|
||||||
func DecodeZigZag(x uint64) int64 {
|
func DecodeZigZag(x uint64) int64 {
|
||||||
|
|
@ -514,6 +520,7 @@ func DecodeZigZag(x uint64) int64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// EncodeZigZag encodes an int64 as a zig-zag-encoded uint64.
|
// EncodeZigZag encodes an int64 as a zig-zag-encoded uint64.
|
||||||
|
//
|
||||||
// Input: {…, -3, -2, -1, 0, +1, +2, +3, …}
|
// Input: {…, -3, -2, -1, 0, +1, +2, +3, …}
|
||||||
// Output: {…, 5, 3, 1, 0, 2, 4, 6, …}
|
// Output: {…, 5, 3, 1, 0, 2, 4, 6, …}
|
||||||
func EncodeZigZag(x int64) uint64 {
|
func EncodeZigZag(x int64) uint64 {
|
||||||
|
|
@ -521,6 +528,7 @@ func EncodeZigZag(x int64) uint64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeBool decodes a uint64 as a bool.
|
// DecodeBool decodes a uint64 as a bool.
|
||||||
|
//
|
||||||
// Input: { 0, 1, 2, …}
|
// Input: { 0, 1, 2, …}
|
||||||
// Output: {false, true, true, …}
|
// Output: {false, true, true, …}
|
||||||
func DecodeBool(x uint64) bool {
|
func DecodeBool(x uint64) bool {
|
||||||
|
|
@ -528,6 +536,7 @@ func DecodeBool(x uint64) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// EncodeBool encodes a bool as a uint64.
|
// EncodeBool encodes a bool as a uint64.
|
||||||
|
//
|
||||||
// Input: {false, true}
|
// Input: {false, true}
|
||||||
// Output: { 0, 1}
|
// Output: { 0, 1}
|
||||||
func EncodeBool(x bool) uint64 {
|
func EncodeBool(x bool) uint64 {
|
||||||
|
|
|
||||||
230
vendor/google.golang.org/protobuf/internal/descfmt/stringer.go
generated
vendored
230
vendor/google.golang.org/protobuf/internal/descfmt/stringer.go
generated
vendored
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
"google.golang.org/protobuf/internal/detrand"
|
"google.golang.org/protobuf/internal/detrand"
|
||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type list interface {
|
type list interface {
|
||||||
|
|
@ -30,17 +30,17 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
||||||
if isRoot {
|
if isRoot {
|
||||||
var name string
|
var name string
|
||||||
switch vs.(type) {
|
switch vs.(type) {
|
||||||
case pref.Names:
|
case protoreflect.Names:
|
||||||
name = "Names"
|
name = "Names"
|
||||||
case pref.FieldNumbers:
|
case protoreflect.FieldNumbers:
|
||||||
name = "FieldNumbers"
|
name = "FieldNumbers"
|
||||||
case pref.FieldRanges:
|
case protoreflect.FieldRanges:
|
||||||
name = "FieldRanges"
|
name = "FieldRanges"
|
||||||
case pref.EnumRanges:
|
case protoreflect.EnumRanges:
|
||||||
name = "EnumRanges"
|
name = "EnumRanges"
|
||||||
case pref.FileImports:
|
case protoreflect.FileImports:
|
||||||
name = "FileImports"
|
name = "FileImports"
|
||||||
case pref.Descriptor:
|
case protoreflect.Descriptor:
|
||||||
name = reflect.ValueOf(vs).MethodByName("Get").Type().Out(0).Name() + "s"
|
name = reflect.ValueOf(vs).MethodByName("Get").Type().Out(0).Name() + "s"
|
||||||
default:
|
default:
|
||||||
name = reflect.ValueOf(vs).Elem().Type().Name()
|
name = reflect.ValueOf(vs).Elem().Type().Name()
|
||||||
|
|
@ -50,17 +50,17 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
||||||
|
|
||||||
var ss []string
|
var ss []string
|
||||||
switch vs := vs.(type) {
|
switch vs := vs.(type) {
|
||||||
case pref.Names:
|
case protoreflect.Names:
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
ss = append(ss, fmt.Sprint(vs.Get(i)))
|
ss = append(ss, fmt.Sprint(vs.Get(i)))
|
||||||
}
|
}
|
||||||
return start + joinStrings(ss, false) + end
|
return start + joinStrings(ss, false) + end
|
||||||
case pref.FieldNumbers:
|
case protoreflect.FieldNumbers:
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
ss = append(ss, fmt.Sprint(vs.Get(i)))
|
ss = append(ss, fmt.Sprint(vs.Get(i)))
|
||||||
}
|
}
|
||||||
return start + joinStrings(ss, false) + end
|
return start + joinStrings(ss, false) + end
|
||||||
case pref.FieldRanges:
|
case protoreflect.FieldRanges:
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
r := vs.Get(i)
|
r := vs.Get(i)
|
||||||
if r[0]+1 == r[1] {
|
if r[0]+1 == r[1] {
|
||||||
|
|
@ -70,7 +70,7 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return start + joinStrings(ss, false) + end
|
return start + joinStrings(ss, false) + end
|
||||||
case pref.EnumRanges:
|
case protoreflect.EnumRanges:
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
r := vs.Get(i)
|
r := vs.Get(i)
|
||||||
if r[0] == r[1] {
|
if r[0] == r[1] {
|
||||||
|
|
@ -80,46 +80,44 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return start + joinStrings(ss, false) + end
|
return start + joinStrings(ss, false) + end
|
||||||
case pref.FileImports:
|
case protoreflect.FileImports:
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
var rs records
|
var rs records
|
||||||
rs.Append(reflect.ValueOf(vs.Get(i)), "Path", "Package", "IsPublic", "IsWeak")
|
rv := reflect.ValueOf(vs.Get(i))
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Path"), "Path"},
|
||||||
|
{rv.MethodByName("Package"), "Package"},
|
||||||
|
{rv.MethodByName("IsPublic"), "IsPublic"},
|
||||||
|
{rv.MethodByName("IsWeak"), "IsWeak"},
|
||||||
|
}...)
|
||||||
ss = append(ss, "{"+rs.Join()+"}")
|
ss = append(ss, "{"+rs.Join()+"}")
|
||||||
}
|
}
|
||||||
return start + joinStrings(ss, allowMulti) + end
|
return start + joinStrings(ss, allowMulti) + end
|
||||||
default:
|
default:
|
||||||
_, isEnumValue := vs.(pref.EnumValueDescriptors)
|
_, isEnumValue := vs.(protoreflect.EnumValueDescriptors)
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
m := reflect.ValueOf(vs).MethodByName("Get")
|
m := reflect.ValueOf(vs).MethodByName("Get")
|
||||||
v := m.Call([]reflect.Value{reflect.ValueOf(i)})[0].Interface()
|
v := m.Call([]reflect.Value{reflect.ValueOf(i)})[0].Interface()
|
||||||
ss = append(ss, formatDescOpt(v.(pref.Descriptor), false, allowMulti && !isEnumValue))
|
ss = append(ss, formatDescOpt(v.(protoreflect.Descriptor), false, allowMulti && !isEnumValue, nil))
|
||||||
}
|
}
|
||||||
return start + joinStrings(ss, allowMulti && isEnumValue) + end
|
return start + joinStrings(ss, allowMulti && isEnumValue) + end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// descriptorAccessors is a list of accessors to print for each descriptor.
|
type methodAndName struct {
|
||||||
//
|
method reflect.Value
|
||||||
// Do not print all accessors since some contain redundant information,
|
name string
|
||||||
// while others are pointers that we do not want to follow since the descriptor
|
|
||||||
// is actually a cyclic graph.
|
|
||||||
//
|
|
||||||
// Using a list allows us to print the accessors in a sensible order.
|
|
||||||
var descriptorAccessors = map[reflect.Type][]string{
|
|
||||||
reflect.TypeOf((*pref.FileDescriptor)(nil)).Elem(): {"Path", "Package", "Imports", "Messages", "Enums", "Extensions", "Services"},
|
|
||||||
reflect.TypeOf((*pref.MessageDescriptor)(nil)).Elem(): {"IsMapEntry", "Fields", "Oneofs", "ReservedNames", "ReservedRanges", "RequiredNumbers", "ExtensionRanges", "Messages", "Enums", "Extensions"},
|
|
||||||
reflect.TypeOf((*pref.FieldDescriptor)(nil)).Elem(): {"Number", "Cardinality", "Kind", "HasJSONName", "JSONName", "HasPresence", "IsExtension", "IsPacked", "IsWeak", "IsList", "IsMap", "MapKey", "MapValue", "HasDefault", "Default", "ContainingOneof", "ContainingMessage", "Message", "Enum"},
|
|
||||||
reflect.TypeOf((*pref.OneofDescriptor)(nil)).Elem(): {"Fields"}, // not directly used; must keep in sync with formatDescOpt
|
|
||||||
reflect.TypeOf((*pref.EnumDescriptor)(nil)).Elem(): {"Values", "ReservedNames", "ReservedRanges"},
|
|
||||||
reflect.TypeOf((*pref.EnumValueDescriptor)(nil)).Elem(): {"Number"},
|
|
||||||
reflect.TypeOf((*pref.ServiceDescriptor)(nil)).Elem(): {"Methods"},
|
|
||||||
reflect.TypeOf((*pref.MethodDescriptor)(nil)).Elem(): {"Input", "Output", "IsStreamingClient", "IsStreamingServer"},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func FormatDesc(s fmt.State, r rune, t pref.Descriptor) {
|
func FormatDesc(s fmt.State, r rune, t protoreflect.Descriptor) {
|
||||||
io.WriteString(s, formatDescOpt(t, true, r == 'v' && (s.Flag('+') || s.Flag('#'))))
|
io.WriteString(s, formatDescOpt(t, true, r == 'v' && (s.Flag('+') || s.Flag('#')), nil))
|
||||||
}
|
}
|
||||||
func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
|
||||||
|
func InternalFormatDescOptForTesting(t protoreflect.Descriptor, isRoot, allowMulti bool, record func(string)) string {
|
||||||
|
return formatDescOpt(t, isRoot, allowMulti, record)
|
||||||
|
}
|
||||||
|
|
||||||
|
func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool, record func(string)) string {
|
||||||
rv := reflect.ValueOf(t)
|
rv := reflect.ValueOf(t)
|
||||||
rt := rv.MethodByName("ProtoType").Type().In(0)
|
rt := rv.MethodByName("ProtoType").Type().In(0)
|
||||||
|
|
||||||
|
|
@ -128,27 +126,61 @@ func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
||||||
start = rt.Name() + "{"
|
start = rt.Name() + "{"
|
||||||
}
|
}
|
||||||
|
|
||||||
_, isFile := t.(pref.FileDescriptor)
|
_, isFile := t.(protoreflect.FileDescriptor)
|
||||||
rs := records{allowMulti: allowMulti}
|
rs := records{
|
||||||
|
allowMulti: allowMulti,
|
||||||
|
record: record,
|
||||||
|
}
|
||||||
if t.IsPlaceholder() {
|
if t.IsPlaceholder() {
|
||||||
if isFile {
|
if isFile {
|
||||||
rs.Append(rv, "Path", "Package", "IsPlaceholder")
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Path"), "Path"},
|
||||||
|
{rv.MethodByName("Package"), "Package"},
|
||||||
|
{rv.MethodByName("IsPlaceholder"), "IsPlaceholder"},
|
||||||
|
}...)
|
||||||
} else {
|
} else {
|
||||||
rs.Append(rv, "FullName", "IsPlaceholder")
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("FullName"), "FullName"},
|
||||||
|
{rv.MethodByName("IsPlaceholder"), "IsPlaceholder"},
|
||||||
|
}...)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch {
|
switch {
|
||||||
case isFile:
|
case isFile:
|
||||||
rs.Append(rv, "Syntax")
|
rs.Append(rv, methodAndName{rv.MethodByName("Syntax"), "Syntax"})
|
||||||
case isRoot:
|
case isRoot:
|
||||||
rs.Append(rv, "Syntax", "FullName")
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Syntax"), "Syntax"},
|
||||||
|
{rv.MethodByName("FullName"), "FullName"},
|
||||||
|
}...)
|
||||||
default:
|
default:
|
||||||
rs.Append(rv, "Name")
|
rs.Append(rv, methodAndName{rv.MethodByName("Name"), "Name"})
|
||||||
}
|
}
|
||||||
switch t := t.(type) {
|
switch t := t.(type) {
|
||||||
case pref.FieldDescriptor:
|
case protoreflect.FieldDescriptor:
|
||||||
for _, s := range descriptorAccessors[rt] {
|
accessors := []methodAndName{
|
||||||
switch s {
|
{rv.MethodByName("Number"), "Number"},
|
||||||
|
{rv.MethodByName("Cardinality"), "Cardinality"},
|
||||||
|
{rv.MethodByName("Kind"), "Kind"},
|
||||||
|
{rv.MethodByName("HasJSONName"), "HasJSONName"},
|
||||||
|
{rv.MethodByName("JSONName"), "JSONName"},
|
||||||
|
{rv.MethodByName("HasPresence"), "HasPresence"},
|
||||||
|
{rv.MethodByName("IsExtension"), "IsExtension"},
|
||||||
|
{rv.MethodByName("IsPacked"), "IsPacked"},
|
||||||
|
{rv.MethodByName("IsWeak"), "IsWeak"},
|
||||||
|
{rv.MethodByName("IsList"), "IsList"},
|
||||||
|
{rv.MethodByName("IsMap"), "IsMap"},
|
||||||
|
{rv.MethodByName("MapKey"), "MapKey"},
|
||||||
|
{rv.MethodByName("MapValue"), "MapValue"},
|
||||||
|
{rv.MethodByName("HasDefault"), "HasDefault"},
|
||||||
|
{rv.MethodByName("Default"), "Default"},
|
||||||
|
{rv.MethodByName("ContainingOneof"), "ContainingOneof"},
|
||||||
|
{rv.MethodByName("ContainingMessage"), "ContainingMessage"},
|
||||||
|
{rv.MethodByName("Message"), "Message"},
|
||||||
|
{rv.MethodByName("Enum"), "Enum"},
|
||||||
|
}
|
||||||
|
for _, s := range accessors {
|
||||||
|
switch s.name {
|
||||||
case "MapKey":
|
case "MapKey":
|
||||||
if k := t.MapKey(); k != nil {
|
if k := t.MapKey(); k != nil {
|
||||||
rs.recs = append(rs.recs, [2]string{"MapKey", k.Kind().String()})
|
rs.recs = append(rs.recs, [2]string{"MapKey", k.Kind().String()})
|
||||||
|
|
@ -156,21 +188,21 @@ func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
||||||
case "MapValue":
|
case "MapValue":
|
||||||
if v := t.MapValue(); v != nil {
|
if v := t.MapValue(); v != nil {
|
||||||
switch v.Kind() {
|
switch v.Kind() {
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Enum().FullName())})
|
rs.AppendRecs("MapValue", [2]string{"MapValue", string(v.Enum().FullName())})
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Message().FullName())})
|
rs.AppendRecs("MapValue", [2]string{"MapValue", string(v.Message().FullName())})
|
||||||
default:
|
default:
|
||||||
rs.recs = append(rs.recs, [2]string{"MapValue", v.Kind().String()})
|
rs.AppendRecs("MapValue", [2]string{"MapValue", v.Kind().String()})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "ContainingOneof":
|
case "ContainingOneof":
|
||||||
if od := t.ContainingOneof(); od != nil {
|
if od := t.ContainingOneof(); od != nil {
|
||||||
rs.recs = append(rs.recs, [2]string{"Oneof", string(od.Name())})
|
rs.AppendRecs("ContainingOneof", [2]string{"Oneof", string(od.Name())})
|
||||||
}
|
}
|
||||||
case "ContainingMessage":
|
case "ContainingMessage":
|
||||||
if t.IsExtension() {
|
if t.IsExtension() {
|
||||||
rs.recs = append(rs.recs, [2]string{"Extendee", string(t.ContainingMessage().FullName())})
|
rs.AppendRecs("ContainingMessage", [2]string{"Extendee", string(t.ContainingMessage().FullName())})
|
||||||
}
|
}
|
||||||
case "Message":
|
case "Message":
|
||||||
if !t.IsMap() {
|
if !t.IsMap() {
|
||||||
|
|
@ -180,20 +212,69 @@ func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
||||||
rs.Append(rv, s)
|
rs.Append(rv, s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.OneofDescriptor:
|
case protoreflect.OneofDescriptor:
|
||||||
var ss []string
|
var ss []string
|
||||||
fs := t.Fields()
|
fs := t.Fields()
|
||||||
for i := 0; i < fs.Len(); i++ {
|
for i := 0; i < fs.Len(); i++ {
|
||||||
ss = append(ss, string(fs.Get(i).Name()))
|
ss = append(ss, string(fs.Get(i).Name()))
|
||||||
}
|
}
|
||||||
if len(ss) > 0 {
|
if len(ss) > 0 {
|
||||||
rs.recs = append(rs.recs, [2]string{"Fields", "[" + joinStrings(ss, false) + "]"})
|
rs.AppendRecs("Fields", [2]string{"Fields", "[" + joinStrings(ss, false) + "]"})
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
rs.Append(rv, descriptorAccessors[rt]...)
|
case protoreflect.FileDescriptor:
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Path"), "Path"},
|
||||||
|
{rv.MethodByName("Package"), "Package"},
|
||||||
|
{rv.MethodByName("Imports"), "Imports"},
|
||||||
|
{rv.MethodByName("Messages"), "Messages"},
|
||||||
|
{rv.MethodByName("Enums"), "Enums"},
|
||||||
|
{rv.MethodByName("Extensions"), "Extensions"},
|
||||||
|
{rv.MethodByName("Services"), "Services"},
|
||||||
|
}...)
|
||||||
|
|
||||||
|
case protoreflect.MessageDescriptor:
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("IsMapEntry"), "IsMapEntry"},
|
||||||
|
{rv.MethodByName("Fields"), "Fields"},
|
||||||
|
{rv.MethodByName("Oneofs"), "Oneofs"},
|
||||||
|
{rv.MethodByName("ReservedNames"), "ReservedNames"},
|
||||||
|
{rv.MethodByName("ReservedRanges"), "ReservedRanges"},
|
||||||
|
{rv.MethodByName("RequiredNumbers"), "RequiredNumbers"},
|
||||||
|
{rv.MethodByName("ExtensionRanges"), "ExtensionRanges"},
|
||||||
|
{rv.MethodByName("Messages"), "Messages"},
|
||||||
|
{rv.MethodByName("Enums"), "Enums"},
|
||||||
|
{rv.MethodByName("Extensions"), "Extensions"},
|
||||||
|
}...)
|
||||||
|
|
||||||
|
case protoreflect.EnumDescriptor:
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Values"), "Values"},
|
||||||
|
{rv.MethodByName("ReservedNames"), "ReservedNames"},
|
||||||
|
{rv.MethodByName("ReservedRanges"), "ReservedRanges"},
|
||||||
|
{rv.MethodByName("IsClosed"), "IsClosed"},
|
||||||
|
}...)
|
||||||
|
|
||||||
|
case protoreflect.EnumValueDescriptor:
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Number"), "Number"},
|
||||||
|
}...)
|
||||||
|
|
||||||
|
case protoreflect.ServiceDescriptor:
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Methods"), "Methods"},
|
||||||
|
}...)
|
||||||
|
|
||||||
|
case protoreflect.MethodDescriptor:
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Input"), "Input"},
|
||||||
|
{rv.MethodByName("Output"), "Output"},
|
||||||
|
{rv.MethodByName("IsStreamingClient"), "IsStreamingClient"},
|
||||||
|
{rv.MethodByName("IsStreamingServer"), "IsStreamingServer"},
|
||||||
|
}...)
|
||||||
}
|
}
|
||||||
if rv.MethodByName("GoType").IsValid() {
|
if m := rv.MethodByName("GoType"); m.IsValid() {
|
||||||
rs.Append(rv, "GoType")
|
rs.Append(rv, methodAndName{m, "GoType"})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return start + rs.Join() + end
|
return start + rs.Join() + end
|
||||||
|
|
@ -202,21 +283,36 @@ func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
||||||
type records struct {
|
type records struct {
|
||||||
recs [][2]string
|
recs [][2]string
|
||||||
allowMulti bool
|
allowMulti bool
|
||||||
|
|
||||||
|
// record is a function that will be called for every Append() or
|
||||||
|
// AppendRecs() call, to be used for testing with the
|
||||||
|
// InternalFormatDescOptForTesting function.
|
||||||
|
record func(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rs *records) Append(v reflect.Value, accessors ...string) {
|
func (rs *records) AppendRecs(fieldName string, newRecs [2]string) {
|
||||||
|
if rs.record != nil {
|
||||||
|
rs.record(fieldName)
|
||||||
|
}
|
||||||
|
rs.recs = append(rs.recs, newRecs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rs *records) Append(v reflect.Value, accessors ...methodAndName) {
|
||||||
for _, a := range accessors {
|
for _, a := range accessors {
|
||||||
|
if rs.record != nil {
|
||||||
|
rs.record(a.name)
|
||||||
|
}
|
||||||
var rv reflect.Value
|
var rv reflect.Value
|
||||||
if m := v.MethodByName(a); m.IsValid() {
|
if a.method.IsValid() {
|
||||||
rv = m.Call(nil)[0]
|
rv = a.method.Call(nil)[0]
|
||||||
}
|
}
|
||||||
if v.Kind() == reflect.Struct && !rv.IsValid() {
|
if v.Kind() == reflect.Struct && !rv.IsValid() {
|
||||||
rv = v.FieldByName(a)
|
rv = v.FieldByName(a.name)
|
||||||
}
|
}
|
||||||
if !rv.IsValid() {
|
if !rv.IsValid() {
|
||||||
panic(fmt.Sprintf("unknown accessor: %v.%s", v.Type(), a))
|
panic(fmt.Sprintf("unknown accessor: %v.%s", v.Type(), a.name))
|
||||||
}
|
}
|
||||||
if _, ok := rv.Interface().(pref.Value); ok {
|
if _, ok := rv.Interface().(protoreflect.Value); ok {
|
||||||
rv = rv.MethodByName("Interface").Call(nil)[0]
|
rv = rv.MethodByName("Interface").Call(nil)[0]
|
||||||
if !rv.IsNil() {
|
if !rv.IsNil() {
|
||||||
rv = rv.Elem()
|
rv = rv.Elem()
|
||||||
|
|
@ -250,9 +346,9 @@ func (rs *records) Append(v reflect.Value, accessors ...string) {
|
||||||
switch v := v.(type) {
|
switch v := v.(type) {
|
||||||
case list:
|
case list:
|
||||||
s = formatListOpt(v, false, rs.allowMulti)
|
s = formatListOpt(v, false, rs.allowMulti)
|
||||||
case pref.FieldDescriptor, pref.OneofDescriptor, pref.EnumValueDescriptor, pref.MethodDescriptor:
|
case protoreflect.FieldDescriptor, protoreflect.OneofDescriptor, protoreflect.EnumValueDescriptor, protoreflect.MethodDescriptor:
|
||||||
s = string(v.(pref.Descriptor).Name())
|
s = string(v.(protoreflect.Descriptor).Name())
|
||||||
case pref.Descriptor:
|
case protoreflect.Descriptor:
|
||||||
s = string(v.FullName())
|
s = string(v.FullName())
|
||||||
case string:
|
case string:
|
||||||
s = strconv.Quote(v)
|
s = strconv.Quote(v)
|
||||||
|
|
@ -261,7 +357,7 @@ func (rs *records) Append(v reflect.Value, accessors ...string) {
|
||||||
default:
|
default:
|
||||||
s = fmt.Sprint(v)
|
s = fmt.Sprint(v)
|
||||||
}
|
}
|
||||||
rs.recs = append(rs.recs, [2]string{a, s})
|
rs.recs = append(rs.recs, [2]string{a.name, s})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
12
vendor/google.golang.org/protobuf/internal/editiondefaults/defaults.go
generated
vendored
Normal file
12
vendor/google.golang.org/protobuf/internal/editiondefaults/defaults.go
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright 2024 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 editiondefaults contains the binary representation of the editions
|
||||||
|
// defaults.
|
||||||
|
package editiondefaults
|
||||||
|
|
||||||
|
import _ "embed"
|
||||||
|
|
||||||
|
//go:embed editions_defaults.binpb
|
||||||
|
var Defaults []byte
|
||||||
BIN
vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb
generated
vendored
Normal file
BIN
vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb
generated
vendored
Normal file
Binary file not shown.
13
vendor/google.golang.org/protobuf/internal/editionssupport/editions.go
generated
vendored
Normal file
13
vendor/google.golang.org/protobuf/internal/editionssupport/editions.go
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
// Copyright 2024 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 editionssupport defines constants for editions that are supported.
|
||||||
|
package editionssupport
|
||||||
|
|
||||||
|
import descriptorpb "google.golang.org/protobuf/types/descriptorpb"
|
||||||
|
|
||||||
|
const (
|
||||||
|
Minimum = descriptorpb.Edition_EDITION_PROTO2
|
||||||
|
Maximum = descriptorpb.Edition_EDITION_2023
|
||||||
|
)
|
||||||
78
vendor/google.golang.org/protobuf/internal/encoding/defval/default.go
generated
vendored
78
vendor/google.golang.org/protobuf/internal/encoding/defval/default.go
generated
vendored
|
|
@ -15,8 +15,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
ptext "google.golang.org/protobuf/internal/encoding/text"
|
ptext "google.golang.org/protobuf/internal/encoding/text"
|
||||||
errors "google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Format is the serialization format used to represent the default value.
|
// Format is the serialization format used to represent the default value.
|
||||||
|
|
@ -35,56 +35,56 @@ const (
|
||||||
|
|
||||||
// Unmarshal deserializes the default string s according to the given kind k.
|
// Unmarshal deserializes the default string s according to the given kind k.
|
||||||
// When k is an enum, a list of enum value descriptors must be provided.
|
// When k is an enum, a list of enum value descriptors must be provided.
|
||||||
func Unmarshal(s string, k pref.Kind, evs pref.EnumValueDescriptors, f Format) (pref.Value, pref.EnumValueDescriptor, error) {
|
func Unmarshal(s string, k protoreflect.Kind, evs protoreflect.EnumValueDescriptors, f Format) (protoreflect.Value, protoreflect.EnumValueDescriptor, error) {
|
||||||
switch k {
|
switch k {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if f == GoTag {
|
if f == GoTag {
|
||||||
switch s {
|
switch s {
|
||||||
case "1":
|
case "1":
|
||||||
return pref.ValueOfBool(true), nil, nil
|
return protoreflect.ValueOfBool(true), nil, nil
|
||||||
case "0":
|
case "0":
|
||||||
return pref.ValueOfBool(false), nil, nil
|
return protoreflect.ValueOfBool(false), nil, nil
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch s {
|
switch s {
|
||||||
case "true":
|
case "true":
|
||||||
return pref.ValueOfBool(true), nil, nil
|
return protoreflect.ValueOfBool(true), nil, nil
|
||||||
case "false":
|
case "false":
|
||||||
return pref.ValueOfBool(false), nil, nil
|
return protoreflect.ValueOfBool(false), nil, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if f == GoTag {
|
if f == GoTag {
|
||||||
// Go tags use the numeric form of the enum value.
|
// Go tags use the numeric form of the enum value.
|
||||||
if n, err := strconv.ParseInt(s, 10, 32); err == nil {
|
if n, err := strconv.ParseInt(s, 10, 32); err == nil {
|
||||||
if ev := evs.ByNumber(pref.EnumNumber(n)); ev != nil {
|
if ev := evs.ByNumber(protoreflect.EnumNumber(n)); ev != nil {
|
||||||
return pref.ValueOfEnum(ev.Number()), ev, nil
|
return protoreflect.ValueOfEnum(ev.Number()), ev, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Descriptor default_value use the enum identifier.
|
// Descriptor default_value use the enum identifier.
|
||||||
ev := evs.ByName(pref.Name(s))
|
ev := evs.ByName(protoreflect.Name(s))
|
||||||
if ev != nil {
|
if ev != nil {
|
||||||
return pref.ValueOfEnum(ev.Number()), ev, nil
|
return protoreflect.ValueOfEnum(ev.Number()), ev, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||||
if v, err := strconv.ParseInt(s, 10, 32); err == nil {
|
if v, err := strconv.ParseInt(s, 10, 32); err == nil {
|
||||||
return pref.ValueOfInt32(int32(v)), nil, nil
|
return protoreflect.ValueOfInt32(int32(v)), nil, nil
|
||||||
}
|
}
|
||||||
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||||
if v, err := strconv.ParseInt(s, 10, 64); err == nil {
|
if v, err := strconv.ParseInt(s, 10, 64); err == nil {
|
||||||
return pref.ValueOfInt64(int64(v)), nil, nil
|
return protoreflect.ValueOfInt64(int64(v)), nil, nil
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||||
if v, err := strconv.ParseUint(s, 10, 32); err == nil {
|
if v, err := strconv.ParseUint(s, 10, 32); err == nil {
|
||||||
return pref.ValueOfUint32(uint32(v)), nil, nil
|
return protoreflect.ValueOfUint32(uint32(v)), nil, nil
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind, pref.Fixed64Kind:
|
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||||
if v, err := strconv.ParseUint(s, 10, 64); err == nil {
|
if v, err := strconv.ParseUint(s, 10, 64); err == nil {
|
||||||
return pref.ValueOfUint64(uint64(v)), nil, nil
|
return protoreflect.ValueOfUint64(uint64(v)), nil, nil
|
||||||
}
|
}
|
||||||
case pref.FloatKind, pref.DoubleKind:
|
case protoreflect.FloatKind, protoreflect.DoubleKind:
|
||||||
var v float64
|
var v float64
|
||||||
var err error
|
var err error
|
||||||
switch s {
|
switch s {
|
||||||
|
|
@ -98,29 +98,29 @@ func Unmarshal(s string, k pref.Kind, evs pref.EnumValueDescriptors, f Format) (
|
||||||
v, err = strconv.ParseFloat(s, 64)
|
v, err = strconv.ParseFloat(s, 64)
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if k == pref.FloatKind {
|
if k == protoreflect.FloatKind {
|
||||||
return pref.ValueOfFloat32(float32(v)), nil, nil
|
return protoreflect.ValueOfFloat32(float32(v)), nil, nil
|
||||||
} else {
|
} else {
|
||||||
return pref.ValueOfFloat64(float64(v)), nil, nil
|
return protoreflect.ValueOfFloat64(float64(v)), nil, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
// String values are already unescaped and can be used as is.
|
// String values are already unescaped and can be used as is.
|
||||||
return pref.ValueOfString(s), nil, nil
|
return protoreflect.ValueOfString(s), nil, nil
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if b, ok := unmarshalBytes(s); ok {
|
if b, ok := unmarshalBytes(s); ok {
|
||||||
return pref.ValueOfBytes(b), nil, nil
|
return protoreflect.ValueOfBytes(b), nil, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pref.Value{}, nil, errors.New("could not parse value for %v: %q", k, s)
|
return protoreflect.Value{}, nil, errors.New("could not parse value for %v: %q", k, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal serializes v as the default string according to the given kind k.
|
// Marshal serializes v as the default string according to the given kind k.
|
||||||
// When specifying the Descriptor format for an enum kind, the associated
|
// When specifying the Descriptor format for an enum kind, the associated
|
||||||
// enum value descriptor must be provided.
|
// enum value descriptor must be provided.
|
||||||
func Marshal(v pref.Value, ev pref.EnumValueDescriptor, k pref.Kind, f Format) (string, error) {
|
func Marshal(v protoreflect.Value, ev protoreflect.EnumValueDescriptor, k protoreflect.Kind, f Format) (string, error) {
|
||||||
switch k {
|
switch k {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if f == GoTag {
|
if f == GoTag {
|
||||||
if v.Bool() {
|
if v.Bool() {
|
||||||
return "1", nil
|
return "1", nil
|
||||||
|
|
@ -134,17 +134,17 @@ func Marshal(v pref.Value, ev pref.EnumValueDescriptor, k pref.Kind, f Format) (
|
||||||
return "false", nil
|
return "false", nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if f == GoTag {
|
if f == GoTag {
|
||||||
return strconv.FormatInt(int64(v.Enum()), 10), nil
|
return strconv.FormatInt(int64(v.Enum()), 10), nil
|
||||||
} else {
|
} else {
|
||||||
return string(ev.Name()), nil
|
return string(ev.Name()), nil
|
||||||
}
|
}
|
||||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind, pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||||
return strconv.FormatInt(v.Int(), 10), nil
|
return strconv.FormatInt(v.Int(), 10), nil
|
||||||
case pref.Uint32Kind, pref.Fixed32Kind, pref.Uint64Kind, pref.Fixed64Kind:
|
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||||
return strconv.FormatUint(v.Uint(), 10), nil
|
return strconv.FormatUint(v.Uint(), 10), nil
|
||||||
case pref.FloatKind, pref.DoubleKind:
|
case protoreflect.FloatKind, protoreflect.DoubleKind:
|
||||||
f := v.Float()
|
f := v.Float()
|
||||||
switch {
|
switch {
|
||||||
case math.IsInf(f, -1):
|
case math.IsInf(f, -1):
|
||||||
|
|
@ -154,16 +154,16 @@ func Marshal(v pref.Value, ev pref.EnumValueDescriptor, k pref.Kind, f Format) (
|
||||||
case math.IsNaN(f):
|
case math.IsNaN(f):
|
||||||
return "nan", nil
|
return "nan", nil
|
||||||
default:
|
default:
|
||||||
if k == pref.FloatKind {
|
if k == protoreflect.FloatKind {
|
||||||
return strconv.FormatFloat(f, 'g', -1, 32), nil
|
return strconv.FormatFloat(f, 'g', -1, 32), nil
|
||||||
} else {
|
} else {
|
||||||
return strconv.FormatFloat(f, 'g', -1, 64), nil
|
return strconv.FormatFloat(f, 'g', -1, 64), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
// String values are serialized as is without any escaping.
|
// String values are serialized as is without any escaping.
|
||||||
return v.String(), nil
|
return v.String(), nil
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if s, ok := marshalBytes(v.Bytes()); ok {
|
if s, ok := marshalBytes(v.Bytes()); ok {
|
||||||
return s, nil
|
return s, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go
generated
vendored
7
vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go
generated
vendored
|
|
@ -10,7 +10,7 @@ import (
|
||||||
|
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The MessageSet wire format is equivalent to a message defined as follows,
|
// The MessageSet wire format is equivalent to a message defined as follows,
|
||||||
|
|
@ -33,6 +33,7 @@ const (
|
||||||
// ExtensionName is the field name for extensions of MessageSet.
|
// ExtensionName is the field name for extensions of MessageSet.
|
||||||
//
|
//
|
||||||
// A valid MessageSet extension must be of the form:
|
// A valid MessageSet extension must be of the form:
|
||||||
|
//
|
||||||
// message MyMessage {
|
// message MyMessage {
|
||||||
// extend proto2.bridge.MessageSet {
|
// extend proto2.bridge.MessageSet {
|
||||||
// optional MyMessage message_set_extension = 1234;
|
// optional MyMessage message_set_extension = 1234;
|
||||||
|
|
@ -42,13 +43,13 @@ const (
|
||||||
const ExtensionName = "message_set_extension"
|
const ExtensionName = "message_set_extension"
|
||||||
|
|
||||||
// IsMessageSet returns whether the message uses the MessageSet wire format.
|
// IsMessageSet returns whether the message uses the MessageSet wire format.
|
||||||
func IsMessageSet(md pref.MessageDescriptor) bool {
|
func IsMessageSet(md protoreflect.MessageDescriptor) bool {
|
||||||
xmd, ok := md.(interface{ IsMessageSet() bool })
|
xmd, ok := md.(interface{ IsMessageSet() bool })
|
||||||
return ok && xmd.IsMessageSet()
|
return ok && xmd.IsMessageSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsMessageSetExtension reports this field properly extends a MessageSet.
|
// IsMessageSetExtension reports this field properly extends a MessageSet.
|
||||||
func IsMessageSetExtension(fd pref.FieldDescriptor) bool {
|
func IsMessageSetExtension(fd protoreflect.FieldDescriptor) bool {
|
||||||
switch {
|
switch {
|
||||||
case fd.Name() != ExtensionName:
|
case fd.Name() != ExtensionName:
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
100
vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go
generated
vendored
100
vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go
generated
vendored
|
|
@ -11,10 +11,10 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
defval "google.golang.org/protobuf/internal/encoding/defval"
|
"google.golang.org/protobuf/internal/encoding/defval"
|
||||||
fdesc "google.golang.org/protobuf/internal/filedesc"
|
"google.golang.org/protobuf/internal/filedesc"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
var byteType = reflect.TypeOf(byte(0))
|
var byteType = reflect.TypeOf(byte(0))
|
||||||
|
|
@ -29,9 +29,10 @@ var byteType = reflect.TypeOf(byte(0))
|
||||||
// This does not populate the Enum or Message (except for weak message).
|
// This does not populate the Enum or Message (except for weak message).
|
||||||
//
|
//
|
||||||
// This function is a best effort attempt; parsing errors are ignored.
|
// This function is a best effort attempt; parsing errors are ignored.
|
||||||
func Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) pref.FieldDescriptor {
|
func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescriptors) protoreflect.FieldDescriptor {
|
||||||
f := new(fdesc.Field)
|
f := new(filedesc.Field)
|
||||||
f.L0.ParentFile = fdesc.SurrogateProto2
|
f.L0.ParentFile = filedesc.SurrogateProto2
|
||||||
|
f.L1.EditionFeatures = f.L0.ParentFile.L1.EditionFeatures
|
||||||
for len(tag) > 0 {
|
for len(tag) > 0 {
|
||||||
i := strings.IndexByte(tag, ',')
|
i := strings.IndexByte(tag, ',')
|
||||||
if i < 0 {
|
if i < 0 {
|
||||||
|
|
@ -39,95 +40,94 @@ func Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) p
|
||||||
}
|
}
|
||||||
switch s := tag[:i]; {
|
switch s := tag[:i]; {
|
||||||
case strings.HasPrefix(s, "name="):
|
case strings.HasPrefix(s, "name="):
|
||||||
f.L0.FullName = pref.FullName(s[len("name="):])
|
f.L0.FullName = protoreflect.FullName(s[len("name="):])
|
||||||
case strings.Trim(s, "0123456789") == "":
|
case strings.Trim(s, "0123456789") == "":
|
||||||
n, _ := strconv.ParseUint(s, 10, 32)
|
n, _ := strconv.ParseUint(s, 10, 32)
|
||||||
f.L1.Number = pref.FieldNumber(n)
|
f.L1.Number = protoreflect.FieldNumber(n)
|
||||||
case s == "opt":
|
case s == "opt":
|
||||||
f.L1.Cardinality = pref.Optional
|
f.L1.Cardinality = protoreflect.Optional
|
||||||
case s == "req":
|
case s == "req":
|
||||||
f.L1.Cardinality = pref.Required
|
f.L1.Cardinality = protoreflect.Required
|
||||||
case s == "rep":
|
case s == "rep":
|
||||||
f.L1.Cardinality = pref.Repeated
|
f.L1.Cardinality = protoreflect.Repeated
|
||||||
case s == "varint":
|
case s == "varint":
|
||||||
switch goType.Kind() {
|
switch goType.Kind() {
|
||||||
case reflect.Bool:
|
case reflect.Bool:
|
||||||
f.L1.Kind = pref.BoolKind
|
f.L1.Kind = protoreflect.BoolKind
|
||||||
case reflect.Int32:
|
case reflect.Int32:
|
||||||
f.L1.Kind = pref.Int32Kind
|
f.L1.Kind = protoreflect.Int32Kind
|
||||||
case reflect.Int64:
|
case reflect.Int64:
|
||||||
f.L1.Kind = pref.Int64Kind
|
f.L1.Kind = protoreflect.Int64Kind
|
||||||
case reflect.Uint32:
|
case reflect.Uint32:
|
||||||
f.L1.Kind = pref.Uint32Kind
|
f.L1.Kind = protoreflect.Uint32Kind
|
||||||
case reflect.Uint64:
|
case reflect.Uint64:
|
||||||
f.L1.Kind = pref.Uint64Kind
|
f.L1.Kind = protoreflect.Uint64Kind
|
||||||
}
|
}
|
||||||
case s == "zigzag32":
|
case s == "zigzag32":
|
||||||
if goType.Kind() == reflect.Int32 {
|
if goType.Kind() == reflect.Int32 {
|
||||||
f.L1.Kind = pref.Sint32Kind
|
f.L1.Kind = protoreflect.Sint32Kind
|
||||||
}
|
}
|
||||||
case s == "zigzag64":
|
case s == "zigzag64":
|
||||||
if goType.Kind() == reflect.Int64 {
|
if goType.Kind() == reflect.Int64 {
|
||||||
f.L1.Kind = pref.Sint64Kind
|
f.L1.Kind = protoreflect.Sint64Kind
|
||||||
}
|
}
|
||||||
case s == "fixed32":
|
case s == "fixed32":
|
||||||
switch goType.Kind() {
|
switch goType.Kind() {
|
||||||
case reflect.Int32:
|
case reflect.Int32:
|
||||||
f.L1.Kind = pref.Sfixed32Kind
|
f.L1.Kind = protoreflect.Sfixed32Kind
|
||||||
case reflect.Uint32:
|
case reflect.Uint32:
|
||||||
f.L1.Kind = pref.Fixed32Kind
|
f.L1.Kind = protoreflect.Fixed32Kind
|
||||||
case reflect.Float32:
|
case reflect.Float32:
|
||||||
f.L1.Kind = pref.FloatKind
|
f.L1.Kind = protoreflect.FloatKind
|
||||||
}
|
}
|
||||||
case s == "fixed64":
|
case s == "fixed64":
|
||||||
switch goType.Kind() {
|
switch goType.Kind() {
|
||||||
case reflect.Int64:
|
case reflect.Int64:
|
||||||
f.L1.Kind = pref.Sfixed64Kind
|
f.L1.Kind = protoreflect.Sfixed64Kind
|
||||||
case reflect.Uint64:
|
case reflect.Uint64:
|
||||||
f.L1.Kind = pref.Fixed64Kind
|
f.L1.Kind = protoreflect.Fixed64Kind
|
||||||
case reflect.Float64:
|
case reflect.Float64:
|
||||||
f.L1.Kind = pref.DoubleKind
|
f.L1.Kind = protoreflect.DoubleKind
|
||||||
}
|
}
|
||||||
case s == "bytes":
|
case s == "bytes":
|
||||||
switch {
|
switch {
|
||||||
case goType.Kind() == reflect.String:
|
case goType.Kind() == reflect.String:
|
||||||
f.L1.Kind = pref.StringKind
|
f.L1.Kind = protoreflect.StringKind
|
||||||
case goType.Kind() == reflect.Slice && goType.Elem() == byteType:
|
case goType.Kind() == reflect.Slice && goType.Elem() == byteType:
|
||||||
f.L1.Kind = pref.BytesKind
|
f.L1.Kind = protoreflect.BytesKind
|
||||||
default:
|
default:
|
||||||
f.L1.Kind = pref.MessageKind
|
f.L1.Kind = protoreflect.MessageKind
|
||||||
}
|
}
|
||||||
case s == "group":
|
case s == "group":
|
||||||
f.L1.Kind = pref.GroupKind
|
f.L1.Kind = protoreflect.GroupKind
|
||||||
case strings.HasPrefix(s, "enum="):
|
case strings.HasPrefix(s, "enum="):
|
||||||
f.L1.Kind = pref.EnumKind
|
f.L1.Kind = protoreflect.EnumKind
|
||||||
case strings.HasPrefix(s, "json="):
|
case strings.HasPrefix(s, "json="):
|
||||||
jsonName := s[len("json="):]
|
jsonName := s[len("json="):]
|
||||||
if jsonName != strs.JSONCamelCase(string(f.L0.FullName.Name())) {
|
if jsonName != strs.JSONCamelCase(string(f.L0.FullName.Name())) {
|
||||||
f.L1.StringName.InitJSON(jsonName)
|
f.L1.StringName.InitJSON(jsonName)
|
||||||
}
|
}
|
||||||
case s == "packed":
|
case s == "packed":
|
||||||
f.L1.HasPacked = true
|
f.L1.EditionFeatures.IsPacked = true
|
||||||
f.L1.IsPacked = true
|
|
||||||
case strings.HasPrefix(s, "weak="):
|
case strings.HasPrefix(s, "weak="):
|
||||||
f.L1.IsWeak = true
|
f.L1.IsWeak = true
|
||||||
f.L1.Message = fdesc.PlaceholderMessage(pref.FullName(s[len("weak="):]))
|
f.L1.Message = filedesc.PlaceholderMessage(protoreflect.FullName(s[len("weak="):]))
|
||||||
case strings.HasPrefix(s, "def="):
|
case strings.HasPrefix(s, "def="):
|
||||||
// The default tag is special in that everything afterwards is the
|
// The default tag is special in that everything afterwards is the
|
||||||
// default regardless of the presence of commas.
|
// default regardless of the presence of commas.
|
||||||
s, i = tag[len("def="):], len(tag)
|
s, i = tag[len("def="):], len(tag)
|
||||||
v, ev, _ := defval.Unmarshal(s, f.L1.Kind, evs, defval.GoTag)
|
v, ev, _ := defval.Unmarshal(s, f.L1.Kind, evs, defval.GoTag)
|
||||||
f.L1.Default = fdesc.DefaultValue(v, ev)
|
f.L1.Default = filedesc.DefaultValue(v, ev)
|
||||||
case s == "proto3":
|
case s == "proto3":
|
||||||
f.L0.ParentFile = fdesc.SurrogateProto3
|
f.L0.ParentFile = filedesc.SurrogateProto3
|
||||||
}
|
}
|
||||||
tag = strings.TrimPrefix(tag[i:], ",")
|
tag = strings.TrimPrefix(tag[i:], ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
// The generator uses the group message name instead of the field name.
|
// The generator uses the group message name instead of the field name.
|
||||||
// We obtain the real field name by lowercasing the group name.
|
// We obtain the real field name by lowercasing the group name.
|
||||||
if f.L1.Kind == pref.GroupKind {
|
if f.L1.Kind == protoreflect.GroupKind {
|
||||||
f.L0.FullName = pref.FullName(strings.ToLower(string(f.L0.FullName)))
|
f.L0.FullName = protoreflect.FullName(strings.ToLower(string(f.L0.FullName)))
|
||||||
}
|
}
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
@ -140,38 +140,38 @@ func Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) p
|
||||||
// Depending on the context on how Marshal is called, there are different ways
|
// Depending on the context on how Marshal is called, there are different ways
|
||||||
// through which that information is determined. As such it is the caller's
|
// through which that information is determined. As such it is the caller's
|
||||||
// responsibility to provide a function to obtain that information.
|
// responsibility to provide a function to obtain that information.
|
||||||
func Marshal(fd pref.FieldDescriptor, enumName string) string {
|
func Marshal(fd protoreflect.FieldDescriptor, enumName string) string {
|
||||||
var tag []string
|
var tag []string
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind, pref.EnumKind, pref.Int32Kind, pref.Uint32Kind, pref.Int64Kind, pref.Uint64Kind:
|
case protoreflect.BoolKind, protoreflect.EnumKind, protoreflect.Int32Kind, protoreflect.Uint32Kind, protoreflect.Int64Kind, protoreflect.Uint64Kind:
|
||||||
tag = append(tag, "varint")
|
tag = append(tag, "varint")
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
tag = append(tag, "zigzag32")
|
tag = append(tag, "zigzag32")
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
tag = append(tag, "zigzag64")
|
tag = append(tag, "zigzag64")
|
||||||
case pref.Sfixed32Kind, pref.Fixed32Kind, pref.FloatKind:
|
case protoreflect.Sfixed32Kind, protoreflect.Fixed32Kind, protoreflect.FloatKind:
|
||||||
tag = append(tag, "fixed32")
|
tag = append(tag, "fixed32")
|
||||||
case pref.Sfixed64Kind, pref.Fixed64Kind, pref.DoubleKind:
|
case protoreflect.Sfixed64Kind, protoreflect.Fixed64Kind, protoreflect.DoubleKind:
|
||||||
tag = append(tag, "fixed64")
|
tag = append(tag, "fixed64")
|
||||||
case pref.StringKind, pref.BytesKind, pref.MessageKind:
|
case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind:
|
||||||
tag = append(tag, "bytes")
|
tag = append(tag, "bytes")
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
tag = append(tag, "group")
|
tag = append(tag, "group")
|
||||||
}
|
}
|
||||||
tag = append(tag, strconv.Itoa(int(fd.Number())))
|
tag = append(tag, strconv.Itoa(int(fd.Number())))
|
||||||
switch fd.Cardinality() {
|
switch fd.Cardinality() {
|
||||||
case pref.Optional:
|
case protoreflect.Optional:
|
||||||
tag = append(tag, "opt")
|
tag = append(tag, "opt")
|
||||||
case pref.Required:
|
case protoreflect.Required:
|
||||||
tag = append(tag, "req")
|
tag = append(tag, "req")
|
||||||
case pref.Repeated:
|
case protoreflect.Repeated:
|
||||||
tag = append(tag, "rep")
|
tag = append(tag, "rep")
|
||||||
}
|
}
|
||||||
if fd.IsPacked() {
|
if fd.IsPacked() {
|
||||||
tag = append(tag, "packed")
|
tag = append(tag, "packed")
|
||||||
}
|
}
|
||||||
name := string(fd.Name())
|
name := string(fd.Name())
|
||||||
if fd.Kind() == pref.GroupKind {
|
if fd.Kind() == protoreflect.GroupKind {
|
||||||
// The name of the FieldDescriptor for a group field is
|
// The name of the FieldDescriptor for a group field is
|
||||||
// lowercased. To find the original capitalization, we
|
// lowercased. To find the original capitalization, we
|
||||||
// look in the field's MessageType.
|
// look in the field's MessageType.
|
||||||
|
|
@ -189,10 +189,10 @@ func Marshal(fd pref.FieldDescriptor, enumName string) string {
|
||||||
// The previous implementation does not tag extension fields as proto3,
|
// The previous implementation does not tag extension fields as proto3,
|
||||||
// even when the field is defined in a proto3 file. Match that behavior
|
// even when the field is defined in a proto3 file. Match that behavior
|
||||||
// for consistency.
|
// for consistency.
|
||||||
if fd.Syntax() == pref.Proto3 && !fd.IsExtension() {
|
if fd.Syntax() == protoreflect.Proto3 && !fd.IsExtension() {
|
||||||
tag = append(tag, "proto3")
|
tag = append(tag, "proto3")
|
||||||
}
|
}
|
||||||
if fd.Kind() == pref.EnumKind && enumName != "" {
|
if fd.Kind() == protoreflect.EnumKind && enumName != "" {
|
||||||
tag = append(tag, "enum="+enumName)
|
tag = append(tag, "enum="+enumName)
|
||||||
}
|
}
|
||||||
if fd.ContainingOneof() != nil {
|
if fd.ContainingOneof() != nil {
|
||||||
|
|
|
||||||
37
vendor/google.golang.org/protobuf/internal/encoding/text/decode.go
generated
vendored
37
vendor/google.golang.org/protobuf/internal/encoding/text/decode.go
generated
vendored
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"regexp"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
|
|
@ -381,7 +380,7 @@ func (d *Decoder) currentOpenKind() (Kind, byte) {
|
||||||
case '[':
|
case '[':
|
||||||
return ListOpen, ']'
|
return ListOpen, ']'
|
||||||
}
|
}
|
||||||
panic(fmt.Sprintf("Decoder: openStack contains invalid byte %s", string(openCh)))
|
panic(fmt.Sprintf("Decoder: openStack contains invalid byte %c", openCh))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Decoder) pushOpenStack(ch byte) {
|
func (d *Decoder) pushOpenStack(ch byte) {
|
||||||
|
|
@ -413,15 +412,16 @@ func (d *Decoder) parseFieldName() (tok Token, err error) {
|
||||||
// Field number. Identify if input is a valid number that is not negative
|
// Field number. Identify if input is a valid number that is not negative
|
||||||
// and is decimal integer within 32-bit range.
|
// and is decimal integer within 32-bit range.
|
||||||
if num := parseNumber(d.in); num.size > 0 {
|
if num := parseNumber(d.in); num.size > 0 {
|
||||||
|
str := num.string(d.in)
|
||||||
if !num.neg && num.kind == numDec {
|
if !num.neg && num.kind == numDec {
|
||||||
if _, err := strconv.ParseInt(string(d.in[:num.size]), 10, 32); err == nil {
|
if _, err := strconv.ParseInt(str, 10, 32); err == nil {
|
||||||
return d.consumeToken(Name, num.size, uint8(FieldNumber)), nil
|
return d.consumeToken(Name, num.size, uint8(FieldNumber)), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Token{}, d.newSyntaxError("invalid field number: %s", d.in[:num.size])
|
return Token{}, d.newSyntaxError("invalid field number: %s", str)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Token{}, d.newSyntaxError("invalid field name: %s", errRegexp.Find(d.in))
|
return Token{}, d.newSyntaxError("invalid field name: %s", errId(d.in))
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseTypeName parses Any type URL or extension field name. The name is
|
// parseTypeName parses Any type URL or extension field name. The name is
|
||||||
|
|
@ -571,7 +571,7 @@ func (d *Decoder) parseScalar() (Token, error) {
|
||||||
return tok, nil
|
return tok, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return Token{}, d.newSyntaxError("invalid scalar value: %s", errRegexp.Find(d.in))
|
return Token{}, d.newSyntaxError("invalid scalar value: %s", errId(d.in))
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseLiteralValue parses a literal value. A literal value is used for
|
// parseLiteralValue parses a literal value. A literal value is used for
|
||||||
|
|
@ -653,8 +653,29 @@ func consume(b []byte, n int) []byte {
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// Any sequence that looks like a non-delimiter (for error reporting).
|
// errId extracts a byte sequence that looks like an invalid ID
|
||||||
var errRegexp = regexp.MustCompile(`^([-+._a-zA-Z0-9\/]+|.)`)
|
// (for the purposes of error reporting).
|
||||||
|
func errId(seq []byte) []byte {
|
||||||
|
const maxLen = 32
|
||||||
|
for i := 0; i < len(seq); {
|
||||||
|
if i > maxLen {
|
||||||
|
return append(seq[:i:i], "…"...)
|
||||||
|
}
|
||||||
|
r, size := utf8.DecodeRune(seq[i:])
|
||||||
|
if r > utf8.RuneSelf || (r != '/' && isDelim(byte(r))) {
|
||||||
|
if i == 0 {
|
||||||
|
// Either the first byte is invalid UTF-8 or a
|
||||||
|
// delimiter, or the first rune is non-ASCII.
|
||||||
|
// Return it as-is.
|
||||||
|
i = size
|
||||||
|
}
|
||||||
|
return seq[:i:i]
|
||||||
|
}
|
||||||
|
i += size
|
||||||
|
}
|
||||||
|
// No delimiter found.
|
||||||
|
return seq
|
||||||
|
}
|
||||||
|
|
||||||
// isDelim returns true if given byte is a delimiter character.
|
// isDelim returns true if given byte is a delimiter character.
|
||||||
func isDelim(c byte) bool {
|
func isDelim(c byte) bool {
|
||||||
|
|
|
||||||
49
vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go
generated
vendored
49
vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go
generated
vendored
|
|
@ -15,17 +15,12 @@ func (d *Decoder) parseNumberValue() (Token, bool) {
|
||||||
if num.neg {
|
if num.neg {
|
||||||
numAttrs |= isNegative
|
numAttrs |= isNegative
|
||||||
}
|
}
|
||||||
strSize := num.size
|
|
||||||
last := num.size - 1
|
|
||||||
if num.kind == numFloat && (d.in[last] == 'f' || d.in[last] == 'F') {
|
|
||||||
strSize = last
|
|
||||||
}
|
|
||||||
tok := Token{
|
tok := Token{
|
||||||
kind: Scalar,
|
kind: Scalar,
|
||||||
attrs: numberValue,
|
attrs: numberValue,
|
||||||
pos: len(d.orig) - len(d.in),
|
pos: len(d.orig) - len(d.in),
|
||||||
raw: d.in[:num.size],
|
raw: d.in[:num.size],
|
||||||
str: string(d.in[:strSize]),
|
str: num.string(d.in),
|
||||||
numAttrs: numAttrs,
|
numAttrs: numAttrs,
|
||||||
}
|
}
|
||||||
d.consume(num.size)
|
d.consume(num.size)
|
||||||
|
|
@ -46,12 +41,35 @@ type number struct {
|
||||||
kind uint8
|
kind uint8
|
||||||
neg bool
|
neg bool
|
||||||
size int
|
size int
|
||||||
|
// if neg, this is the length of whitespace and comments between
|
||||||
|
// the minus sign and the rest fo the number literal
|
||||||
|
sep int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (num number) string(data []byte) string {
|
||||||
|
strSize := num.size
|
||||||
|
last := num.size - 1
|
||||||
|
if num.kind == numFloat && (data[last] == 'f' || data[last] == 'F') {
|
||||||
|
strSize = last
|
||||||
|
}
|
||||||
|
if num.neg && num.sep > 0 {
|
||||||
|
// strip whitespace/comments between negative sign and the rest
|
||||||
|
strLen := strSize - num.sep
|
||||||
|
str := make([]byte, strLen)
|
||||||
|
str[0] = data[0]
|
||||||
|
copy(str[1:], data[num.sep+1:strSize])
|
||||||
|
return string(str)
|
||||||
|
}
|
||||||
|
return string(data[:strSize])
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseNumber constructs a number object from given input. It allows for the
|
// parseNumber constructs a number object from given input. It allows for the
|
||||||
// following patterns:
|
// following patterns:
|
||||||
// integer: ^-?([1-9][0-9]*|0[xX][0-9a-fA-F]+|0[0-7]*)
|
//
|
||||||
// float: ^-?((0|[1-9][0-9]*)?([.][0-9]*)?([eE][+-]?[0-9]+)?[fF]?)
|
// integer: ^-?([1-9][0-9]*|0[xX][0-9a-fA-F]+|0[0-7]*)
|
||||||
|
// float: ^-?((0|[1-9][0-9]*)?([.][0-9]*)?([eE][+-]?[0-9]+)?[fF]?)
|
||||||
|
//
|
||||||
// It also returns the number of parsed bytes for the given number, 0 if it is
|
// It also returns the number of parsed bytes for the given number, 0 if it is
|
||||||
// not a number.
|
// not a number.
|
||||||
func parseNumber(input []byte) number {
|
func parseNumber(input []byte) number {
|
||||||
|
|
@ -65,19 +83,22 @@ func parseNumber(input []byte) number {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optional -
|
// Optional -
|
||||||
|
var sep int
|
||||||
if s[0] == '-' {
|
if s[0] == '-' {
|
||||||
neg = true
|
neg = true
|
||||||
s = s[1:]
|
s = s[1:]
|
||||||
size++
|
size++
|
||||||
|
// Consume any whitespace or comments between the
|
||||||
|
// negative sign and the rest of the number
|
||||||
|
lenBefore := len(s)
|
||||||
|
s = consume(s, 0)
|
||||||
|
sep = lenBefore - len(s)
|
||||||
|
size += sep
|
||||||
if len(s) == 0 {
|
if len(s) == 0 {
|
||||||
return number{}
|
return number{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// C++ allows for whitespace and comments in between the negative sign and
|
|
||||||
// the rest of the number. This logic currently does not but is consistent
|
|
||||||
// with v1.
|
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case s[0] == '0':
|
case s[0] == '0':
|
||||||
if len(s) > 1 {
|
if len(s) > 1 {
|
||||||
|
|
@ -114,7 +135,7 @@ func parseNumber(input []byte) number {
|
||||||
if len(s) > 0 && !isDelim(s[0]) {
|
if len(s) > 0 && !isDelim(s[0]) {
|
||||||
return number{}
|
return number{}
|
||||||
}
|
}
|
||||||
return number{kind: kind, neg: neg, size: size}
|
return number{kind: kind, neg: neg, size: size, sep: sep}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s = s[1:]
|
s = s[1:]
|
||||||
|
|
@ -186,5 +207,5 @@ func parseNumber(input []byte) number {
|
||||||
return number{}
|
return number{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return number{kind: kind, neg: neg, size: size}
|
return number{kind: kind, neg: neg, size: size, sep: sep}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
vendor/google.golang.org/protobuf/internal/encoding/text/doc.go
generated
vendored
4
vendor/google.golang.org/protobuf/internal/encoding/text/doc.go
generated
vendored
|
|
@ -24,6 +24,6 @@
|
||||||
// the Go implementation should as well.
|
// the Go implementation should as well.
|
||||||
//
|
//
|
||||||
// The text format is almost a superset of JSON except:
|
// The text format is almost a superset of JSON except:
|
||||||
// * message keys are not quoted strings, but identifiers
|
// - message keys are not quoted strings, but identifiers
|
||||||
// * the top-level value must be a message without the delimiters
|
// - the top-level value must be a message without the delimiters
|
||||||
package text
|
package text
|
||||||
|
|
|
||||||
15
vendor/google.golang.org/protobuf/internal/encoding/text/encode.go
generated
vendored
15
vendor/google.golang.org/protobuf/internal/encoding/text/encode.go
generated
vendored
|
|
@ -53,8 +53,10 @@ type encoderState struct {
|
||||||
// If outputASCII is true, strings will be serialized in such a way that
|
// If outputASCII is true, strings will be serialized in such a way that
|
||||||
// multi-byte UTF-8 sequences are escaped. This property ensures that the
|
// multi-byte UTF-8 sequences are escaped. This property ensures that the
|
||||||
// overall output is ASCII (as opposed to UTF-8).
|
// overall output is ASCII (as opposed to UTF-8).
|
||||||
func NewEncoder(indent string, delims [2]byte, outputASCII bool) (*Encoder, error) {
|
func NewEncoder(buf []byte, indent string, delims [2]byte, outputASCII bool) (*Encoder, error) {
|
||||||
e := &Encoder{}
|
e := &Encoder{
|
||||||
|
encoderState: encoderState{out: buf},
|
||||||
|
}
|
||||||
if len(indent) > 0 {
|
if len(indent) > 0 {
|
||||||
if strings.Trim(indent, " \t") != "" {
|
if strings.Trim(indent, " \t") != "" {
|
||||||
return nil, errors.New("indent may only be composed of space and tab characters")
|
return nil, errors.New("indent may only be composed of space and tab characters")
|
||||||
|
|
@ -195,13 +197,13 @@ func appendFloat(out []byte, n float64, bitSize int) []byte {
|
||||||
// WriteInt writes out the given signed integer value.
|
// WriteInt writes out the given signed integer value.
|
||||||
func (e *Encoder) WriteInt(n int64) {
|
func (e *Encoder) WriteInt(n int64) {
|
||||||
e.prepareNext(scalar)
|
e.prepareNext(scalar)
|
||||||
e.out = append(e.out, strconv.FormatInt(n, 10)...)
|
e.out = strconv.AppendInt(e.out, n, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteUint writes out the given unsigned integer value.
|
// WriteUint writes out the given unsigned integer value.
|
||||||
func (e *Encoder) WriteUint(n uint64) {
|
func (e *Encoder) WriteUint(n uint64) {
|
||||||
e.prepareNext(scalar)
|
e.prepareNext(scalar)
|
||||||
e.out = append(e.out, strconv.FormatUint(n, 10)...)
|
e.out = strconv.AppendUint(e.out, n, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteLiteral writes out the given string as a literal value without quotes.
|
// WriteLiteral writes out the given string as a literal value without quotes.
|
||||||
|
|
@ -263,3 +265,8 @@ func (e *Encoder) Snapshot() encoderState {
|
||||||
func (e *Encoder) Reset(es encoderState) {
|
func (e *Encoder) Reset(es encoderState) {
|
||||||
e.encoderState = es
|
e.encoderState = es
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AppendString appends the escaped form of the input string to b.
|
||||||
|
func AppendString(b []byte, s string) []byte {
|
||||||
|
return appendString(b, s, false)
|
||||||
|
}
|
||||||
|
|
|
||||||
15
vendor/google.golang.org/protobuf/internal/errors/errors.go
generated
vendored
15
vendor/google.golang.org/protobuf/internal/errors/errors.go
generated
vendored
|
|
@ -87,3 +87,18 @@ func InvalidUTF8(name string) error {
|
||||||
func RequiredNotSet(name string) error {
|
func RequiredNotSet(name string) error {
|
||||||
return New("required field %v not set", name)
|
return New("required field %v not set", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SizeMismatchError struct {
|
||||||
|
Calculated, Measured int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *SizeMismatchError) Error() string {
|
||||||
|
return fmt.Sprintf("size mismatch (see https://github.com/golang/protobuf/issues/1609): calculated=%d, measured=%d", e.Calculated, e.Measured)
|
||||||
|
}
|
||||||
|
|
||||||
|
func MismatchedSizeCalculation(calculated, measured int) error {
|
||||||
|
return &SizeMismatchError{
|
||||||
|
Calculated: calculated,
|
||||||
|
Measured: measured,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
1
vendor/google.golang.org/protobuf/internal/errors/is_go112.go
generated
vendored
1
vendor/google.golang.org/protobuf/internal/errors/is_go112.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !go1.13
|
||||||
// +build !go1.13
|
// +build !go1.13
|
||||||
|
|
||||||
package errors
|
package errors
|
||||||
|
|
|
||||||
1
vendor/google.golang.org/protobuf/internal/errors/is_go113.go
generated
vendored
1
vendor/google.golang.org/protobuf/internal/errors/is_go113.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build go1.13
|
||||||
// +build go1.13
|
// +build go1.13
|
||||||
|
|
||||||
package errors
|
package errors
|
||||||
|
|
|
||||||
19
vendor/google.golang.org/protobuf/internal/filedesc/build.go
generated
vendored
19
vendor/google.golang.org/protobuf/internal/filedesc/build.go
generated
vendored
|
|
@ -12,8 +12,7 @@ import (
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Builder construct a protoreflect.FileDescriptor from the raw descriptor.
|
// Builder construct a protoreflect.FileDescriptor from the raw descriptor.
|
||||||
|
|
@ -38,7 +37,7 @@ type Builder struct {
|
||||||
// TypeResolver resolves extension field types for descriptor options.
|
// TypeResolver resolves extension field types for descriptor options.
|
||||||
// If nil, it uses protoregistry.GlobalTypes.
|
// If nil, it uses protoregistry.GlobalTypes.
|
||||||
TypeResolver interface {
|
TypeResolver interface {
|
||||||
preg.ExtensionTypeResolver
|
protoregistry.ExtensionTypeResolver
|
||||||
}
|
}
|
||||||
|
|
||||||
// FileRegistry is use to lookup file, enum, and message dependencies.
|
// FileRegistry is use to lookup file, enum, and message dependencies.
|
||||||
|
|
@ -46,8 +45,8 @@ type Builder struct {
|
||||||
// If nil, it uses protoregistry.GlobalFiles.
|
// If nil, it uses protoregistry.GlobalFiles.
|
||||||
FileRegistry interface {
|
FileRegistry interface {
|
||||||
FindFileByPath(string) (protoreflect.FileDescriptor, error)
|
FindFileByPath(string) (protoreflect.FileDescriptor, error)
|
||||||
FindDescriptorByName(pref.FullName) (pref.Descriptor, error)
|
FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)
|
||||||
RegisterFile(pref.FileDescriptor) error
|
RegisterFile(protoreflect.FileDescriptor) error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,8 +54,8 @@ type Builder struct {
|
||||||
// If so, it permits looking up an enum or message dependency based on the
|
// If so, it permits looking up an enum or message dependency based on the
|
||||||
// sub-list and element index into filetype.Builder.DependencyIndexes.
|
// sub-list and element index into filetype.Builder.DependencyIndexes.
|
||||||
type resolverByIndex interface {
|
type resolverByIndex interface {
|
||||||
FindEnumByIndex(int32, int32, []Enum, []Message) pref.EnumDescriptor
|
FindEnumByIndex(int32, int32, []Enum, []Message) protoreflect.EnumDescriptor
|
||||||
FindMessageByIndex(int32, int32, []Enum, []Message) pref.MessageDescriptor
|
FindMessageByIndex(int32, int32, []Enum, []Message) protoreflect.MessageDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indexes of each sub-list in filetype.Builder.DependencyIndexes.
|
// Indexes of each sub-list in filetype.Builder.DependencyIndexes.
|
||||||
|
|
@ -70,7 +69,7 @@ const (
|
||||||
|
|
||||||
// Out is the output of the Builder.
|
// Out is the output of the Builder.
|
||||||
type Out struct {
|
type Out struct {
|
||||||
File pref.FileDescriptor
|
File protoreflect.FileDescriptor
|
||||||
|
|
||||||
// Enums is all enum descriptors in "flattened ordering".
|
// Enums is all enum descriptors in "flattened ordering".
|
||||||
Enums []Enum
|
Enums []Enum
|
||||||
|
|
@ -97,10 +96,10 @@ func (db Builder) Build() (out Out) {
|
||||||
|
|
||||||
// Initialize resolvers and registries if unpopulated.
|
// Initialize resolvers and registries if unpopulated.
|
||||||
if db.TypeResolver == nil {
|
if db.TypeResolver == nil {
|
||||||
db.TypeResolver = preg.GlobalTypes
|
db.TypeResolver = protoregistry.GlobalTypes
|
||||||
}
|
}
|
||||||
if db.FileRegistry == nil {
|
if db.FileRegistry == nil {
|
||||||
db.FileRegistry = preg.GlobalFiles
|
db.FileRegistry = protoregistry.GlobalFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
fd := newRawFile(db)
|
fd := newRawFile(db)
|
||||||
|
|
|
||||||
500
vendor/google.golang.org/protobuf/internal/filedesc/desc.go
generated
vendored
500
vendor/google.golang.org/protobuf/internal/filedesc/desc.go
generated
vendored
|
|
@ -7,6 +7,7 @@ package filedesc
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
|
|
@ -17,15 +18,30 @@ import (
|
||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Edition is an Enum for proto2.Edition
|
||||||
|
type Edition int32
|
||||||
|
|
||||||
|
// These values align with the value of Enum in descriptor.proto which allows
|
||||||
|
// direct conversion between the proto enum and this enum.
|
||||||
|
const (
|
||||||
|
EditionUnknown Edition = 0
|
||||||
|
EditionProto2 Edition = 998
|
||||||
|
EditionProto3 Edition = 999
|
||||||
|
Edition2023 Edition = 1000
|
||||||
|
EditionUnsupported Edition = 100000
|
||||||
|
)
|
||||||
|
|
||||||
// The types in this file may have a suffix:
|
// The types in this file may have a suffix:
|
||||||
// • L0: Contains fields common to all descriptors (except File) and
|
// • L0: Contains fields common to all descriptors (except File) and
|
||||||
// must be initialized up front.
|
// must be initialized up front.
|
||||||
// • L1: Contains fields specific to a descriptor and
|
// • L1: Contains fields specific to a descriptor and
|
||||||
// must be initialized up front.
|
// must be initialized up front. If the associated proto uses Editions, the
|
||||||
|
// Editions features must always be resolved. If not explicitly set, the
|
||||||
|
// appropriate default must be resolved and set.
|
||||||
// • L2: Contains fields that are lazily initialized when constructing
|
// • L2: Contains fields that are lazily initialized when constructing
|
||||||
// from the raw file descriptor. When constructing as a literal, the L2
|
// from the raw file descriptor. When constructing as a literal, the L2
|
||||||
// fields must be initialized up front.
|
// fields must be initialized up front.
|
||||||
|
|
@ -43,46 +59,79 @@ type (
|
||||||
L2 *FileL2
|
L2 *FileL2
|
||||||
}
|
}
|
||||||
FileL1 struct {
|
FileL1 struct {
|
||||||
Syntax pref.Syntax
|
Syntax protoreflect.Syntax
|
||||||
|
Edition Edition // Only used if Syntax == Editions
|
||||||
Path string
|
Path string
|
||||||
Package pref.FullName
|
Package protoreflect.FullName
|
||||||
|
|
||||||
Enums Enums
|
Enums Enums
|
||||||
Messages Messages
|
Messages Messages
|
||||||
Extensions Extensions
|
Extensions Extensions
|
||||||
Services Services
|
Services Services
|
||||||
|
|
||||||
|
EditionFeatures EditionFeatures
|
||||||
}
|
}
|
||||||
FileL2 struct {
|
FileL2 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Imports FileImports
|
Imports FileImports
|
||||||
Locations SourceLocations
|
Locations SourceLocations
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EditionFeatures struct {
|
||||||
|
// IsFieldPresence is true if field_presence is EXPLICIT
|
||||||
|
// https://protobuf.dev/editions/features/#field_presence
|
||||||
|
IsFieldPresence bool
|
||||||
|
// IsFieldPresence is true if field_presence is LEGACY_REQUIRED
|
||||||
|
// https://protobuf.dev/editions/features/#field_presence
|
||||||
|
IsLegacyRequired bool
|
||||||
|
// IsOpenEnum is true if enum_type is OPEN
|
||||||
|
// https://protobuf.dev/editions/features/#enum_type
|
||||||
|
IsOpenEnum bool
|
||||||
|
// IsPacked is true if repeated_field_encoding is PACKED
|
||||||
|
// https://protobuf.dev/editions/features/#repeated_field_encoding
|
||||||
|
IsPacked bool
|
||||||
|
// IsUTF8Validated is true if utf_validation is VERIFY
|
||||||
|
// https://protobuf.dev/editions/features/#utf8_validation
|
||||||
|
IsUTF8Validated bool
|
||||||
|
// IsDelimitedEncoded is true if message_encoding is DELIMITED
|
||||||
|
// https://protobuf.dev/editions/features/#message_encoding
|
||||||
|
IsDelimitedEncoded bool
|
||||||
|
// IsJSONCompliant is true if json_format is ALLOW
|
||||||
|
// https://protobuf.dev/editions/features/#json_format
|
||||||
|
IsJSONCompliant bool
|
||||||
|
// GenerateLegacyUnmarshalJSON determines if the plugin generates the
|
||||||
|
// UnmarshalJSON([]byte) error method for enums.
|
||||||
|
GenerateLegacyUnmarshalJSON bool
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (fd *File) ParentFile() pref.FileDescriptor { return fd }
|
func (fd *File) ParentFile() protoreflect.FileDescriptor { return fd }
|
||||||
func (fd *File) Parent() pref.Descriptor { return nil }
|
func (fd *File) Parent() protoreflect.Descriptor { return nil }
|
||||||
func (fd *File) Index() int { return 0 }
|
func (fd *File) Index() int { return 0 }
|
||||||
func (fd *File) Syntax() pref.Syntax { return fd.L1.Syntax }
|
func (fd *File) Syntax() protoreflect.Syntax { return fd.L1.Syntax }
|
||||||
func (fd *File) Name() pref.Name { return fd.L1.Package.Name() }
|
|
||||||
func (fd *File) FullName() pref.FullName { return fd.L1.Package }
|
// Not exported and just used to reconstruct the original FileDescriptor proto
|
||||||
|
func (fd *File) Edition() int32 { return int32(fd.L1.Edition) }
|
||||||
|
func (fd *File) Name() protoreflect.Name { return fd.L1.Package.Name() }
|
||||||
|
func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package }
|
||||||
func (fd *File) IsPlaceholder() bool { return false }
|
func (fd *File) IsPlaceholder() bool { return false }
|
||||||
func (fd *File) Options() pref.ProtoMessage {
|
func (fd *File) Options() protoreflect.ProtoMessage {
|
||||||
if f := fd.lazyInit().Options; f != nil {
|
if f := fd.lazyInit().Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.File
|
return descopts.File
|
||||||
}
|
}
|
||||||
func (fd *File) Path() string { return fd.L1.Path }
|
func (fd *File) Path() string { return fd.L1.Path }
|
||||||
func (fd *File) Package() pref.FullName { return fd.L1.Package }
|
func (fd *File) Package() protoreflect.FullName { return fd.L1.Package }
|
||||||
func (fd *File) Imports() pref.FileImports { return &fd.lazyInit().Imports }
|
func (fd *File) Imports() protoreflect.FileImports { return &fd.lazyInit().Imports }
|
||||||
func (fd *File) Enums() pref.EnumDescriptors { return &fd.L1.Enums }
|
func (fd *File) Enums() protoreflect.EnumDescriptors { return &fd.L1.Enums }
|
||||||
func (fd *File) Messages() pref.MessageDescriptors { return &fd.L1.Messages }
|
func (fd *File) Messages() protoreflect.MessageDescriptors { return &fd.L1.Messages }
|
||||||
func (fd *File) Extensions() pref.ExtensionDescriptors { return &fd.L1.Extensions }
|
func (fd *File) Extensions() protoreflect.ExtensionDescriptors { return &fd.L1.Extensions }
|
||||||
func (fd *File) Services() pref.ServiceDescriptors { return &fd.L1.Services }
|
func (fd *File) Services() protoreflect.ServiceDescriptors { return &fd.L1.Services }
|
||||||
func (fd *File) SourceLocations() pref.SourceLocations { return &fd.lazyInit().Locations }
|
func (fd *File) SourceLocations() protoreflect.SourceLocations { return &fd.lazyInit().Locations }
|
||||||
func (fd *File) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
|
func (fd *File) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
|
||||||
func (fd *File) ProtoType(pref.FileDescriptor) {}
|
func (fd *File) ProtoType(protoreflect.FileDescriptor) {}
|
||||||
func (fd *File) ProtoInternal(pragma.DoNotImplement) {}
|
func (fd *File) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
|
|
||||||
func (fd *File) lazyInit() *FileL2 {
|
func (fd *File) lazyInit() *FileL2 {
|
||||||
if atomic.LoadUint32(&fd.once) == 0 {
|
if atomic.LoadUint32(&fd.once) == 0 {
|
||||||
|
|
@ -117,9 +166,11 @@ type (
|
||||||
}
|
}
|
||||||
EnumL1 struct {
|
EnumL1 struct {
|
||||||
eagerValues bool // controls whether EnumL2.Values is already populated
|
eagerValues bool // controls whether EnumL2.Values is already populated
|
||||||
|
|
||||||
|
EditionFeatures EditionFeatures
|
||||||
}
|
}
|
||||||
EnumL2 struct {
|
EnumL2 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Values EnumValues
|
Values EnumValues
|
||||||
ReservedNames Names
|
ReservedNames Names
|
||||||
ReservedRanges EnumRanges
|
ReservedRanges EnumRanges
|
||||||
|
|
@ -130,41 +181,44 @@ type (
|
||||||
L1 EnumValueL1
|
L1 EnumValueL1
|
||||||
}
|
}
|
||||||
EnumValueL1 struct {
|
EnumValueL1 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Number pref.EnumNumber
|
Number protoreflect.EnumNumber
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (ed *Enum) Options() pref.ProtoMessage {
|
func (ed *Enum) Options() protoreflect.ProtoMessage {
|
||||||
if f := ed.lazyInit().Options; f != nil {
|
if f := ed.lazyInit().Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Enum
|
return descopts.Enum
|
||||||
}
|
}
|
||||||
func (ed *Enum) Values() pref.EnumValueDescriptors {
|
func (ed *Enum) Values() protoreflect.EnumValueDescriptors {
|
||||||
if ed.L1.eagerValues {
|
if ed.L1.eagerValues {
|
||||||
return &ed.L2.Values
|
return &ed.L2.Values
|
||||||
}
|
}
|
||||||
return &ed.lazyInit().Values
|
return &ed.lazyInit().Values
|
||||||
}
|
}
|
||||||
func (ed *Enum) ReservedNames() pref.Names { return &ed.lazyInit().ReservedNames }
|
func (ed *Enum) ReservedNames() protoreflect.Names { return &ed.lazyInit().ReservedNames }
|
||||||
func (ed *Enum) ReservedRanges() pref.EnumRanges { return &ed.lazyInit().ReservedRanges }
|
func (ed *Enum) ReservedRanges() protoreflect.EnumRanges { return &ed.lazyInit().ReservedRanges }
|
||||||
func (ed *Enum) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
|
func (ed *Enum) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
|
||||||
func (ed *Enum) ProtoType(pref.EnumDescriptor) {}
|
func (ed *Enum) ProtoType(protoreflect.EnumDescriptor) {}
|
||||||
func (ed *Enum) lazyInit() *EnumL2 {
|
func (ed *Enum) lazyInit() *EnumL2 {
|
||||||
ed.L0.ParentFile.lazyInit() // implicitly initializes L2
|
ed.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||||
return ed.L2
|
return ed.L2
|
||||||
}
|
}
|
||||||
|
func (ed *Enum) IsClosed() bool {
|
||||||
|
return !ed.L1.EditionFeatures.IsOpenEnum
|
||||||
|
}
|
||||||
|
|
||||||
func (ed *EnumValue) Options() pref.ProtoMessage {
|
func (ed *EnumValue) Options() protoreflect.ProtoMessage {
|
||||||
if f := ed.L1.Options; f != nil {
|
if f := ed.L1.Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.EnumValue
|
return descopts.EnumValue
|
||||||
}
|
}
|
||||||
func (ed *EnumValue) Number() pref.EnumNumber { return ed.L1.Number }
|
func (ed *EnumValue) Number() protoreflect.EnumNumber { return ed.L1.Number }
|
||||||
func (ed *EnumValue) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
|
func (ed *EnumValue) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
|
||||||
func (ed *EnumValue) ProtoType(pref.EnumValueDescriptor) {}
|
func (ed *EnumValue) ProtoType(protoreflect.EnumValueDescriptor) {}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
Message struct {
|
Message struct {
|
||||||
|
|
@ -178,16 +232,18 @@ type (
|
||||||
Extensions Extensions
|
Extensions Extensions
|
||||||
IsMapEntry bool // promoted from google.protobuf.MessageOptions
|
IsMapEntry bool // promoted from google.protobuf.MessageOptions
|
||||||
IsMessageSet bool // promoted from google.protobuf.MessageOptions
|
IsMessageSet bool // promoted from google.protobuf.MessageOptions
|
||||||
|
|
||||||
|
EditionFeatures EditionFeatures
|
||||||
}
|
}
|
||||||
MessageL2 struct {
|
MessageL2 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Fields Fields
|
Fields Fields
|
||||||
Oneofs Oneofs
|
Oneofs Oneofs
|
||||||
ReservedNames Names
|
ReservedNames Names
|
||||||
ReservedRanges FieldRanges
|
ReservedRanges FieldRanges
|
||||||
RequiredNumbers FieldNumbers // must be consistent with Fields.Cardinality
|
RequiredNumbers FieldNumbers // must be consistent with Fields.Cardinality
|
||||||
ExtensionRanges FieldRanges
|
ExtensionRanges FieldRanges
|
||||||
ExtensionRangeOptions []func() pref.ProtoMessage // must be same length as ExtensionRanges
|
ExtensionRangeOptions []func() protoreflect.ProtoMessage // must be same length as ExtensionRanges
|
||||||
}
|
}
|
||||||
|
|
||||||
Field struct {
|
Field struct {
|
||||||
|
|
@ -195,21 +251,19 @@ type (
|
||||||
L1 FieldL1
|
L1 FieldL1
|
||||||
}
|
}
|
||||||
FieldL1 struct {
|
FieldL1 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Number pref.FieldNumber
|
Number protoreflect.FieldNumber
|
||||||
Cardinality pref.Cardinality // must be consistent with Message.RequiredNumbers
|
Cardinality protoreflect.Cardinality // must be consistent with Message.RequiredNumbers
|
||||||
Kind pref.Kind
|
Kind protoreflect.Kind
|
||||||
StringName stringName
|
StringName stringName
|
||||||
IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
|
IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
|
||||||
IsWeak bool // promoted from google.protobuf.FieldOptions
|
IsWeak bool // promoted from google.protobuf.FieldOptions
|
||||||
HasPacked bool // promoted from google.protobuf.FieldOptions
|
|
||||||
IsPacked bool // promoted from google.protobuf.FieldOptions
|
|
||||||
HasEnforceUTF8 bool // promoted from google.protobuf.FieldOptions
|
|
||||||
EnforceUTF8 bool // promoted from google.protobuf.FieldOptions
|
|
||||||
Default defaultValue
|
Default defaultValue
|
||||||
ContainingOneof pref.OneofDescriptor // must be consistent with Message.Oneofs.Fields
|
ContainingOneof protoreflect.OneofDescriptor // must be consistent with Message.Oneofs.Fields
|
||||||
Enum pref.EnumDescriptor
|
Enum protoreflect.EnumDescriptor
|
||||||
Message pref.MessageDescriptor
|
Message protoreflect.MessageDescriptor
|
||||||
|
|
||||||
|
EditionFeatures EditionFeatures
|
||||||
}
|
}
|
||||||
|
|
||||||
Oneof struct {
|
Oneof struct {
|
||||||
|
|
@ -217,35 +271,37 @@ type (
|
||||||
L1 OneofL1
|
L1 OneofL1
|
||||||
}
|
}
|
||||||
OneofL1 struct {
|
OneofL1 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Fields OneofFields // must be consistent with Message.Fields.ContainingOneof
|
Fields OneofFields // must be consistent with Message.Fields.ContainingOneof
|
||||||
|
|
||||||
|
EditionFeatures EditionFeatures
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (md *Message) Options() pref.ProtoMessage {
|
func (md *Message) Options() protoreflect.ProtoMessage {
|
||||||
if f := md.lazyInit().Options; f != nil {
|
if f := md.lazyInit().Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Message
|
return descopts.Message
|
||||||
}
|
}
|
||||||
func (md *Message) IsMapEntry() bool { return md.L1.IsMapEntry }
|
func (md *Message) IsMapEntry() bool { return md.L1.IsMapEntry }
|
||||||
func (md *Message) Fields() pref.FieldDescriptors { return &md.lazyInit().Fields }
|
func (md *Message) Fields() protoreflect.FieldDescriptors { return &md.lazyInit().Fields }
|
||||||
func (md *Message) Oneofs() pref.OneofDescriptors { return &md.lazyInit().Oneofs }
|
func (md *Message) Oneofs() protoreflect.OneofDescriptors { return &md.lazyInit().Oneofs }
|
||||||
func (md *Message) ReservedNames() pref.Names { return &md.lazyInit().ReservedNames }
|
func (md *Message) ReservedNames() protoreflect.Names { return &md.lazyInit().ReservedNames }
|
||||||
func (md *Message) ReservedRanges() pref.FieldRanges { return &md.lazyInit().ReservedRanges }
|
func (md *Message) ReservedRanges() protoreflect.FieldRanges { return &md.lazyInit().ReservedRanges }
|
||||||
func (md *Message) RequiredNumbers() pref.FieldNumbers { return &md.lazyInit().RequiredNumbers }
|
func (md *Message) RequiredNumbers() protoreflect.FieldNumbers { return &md.lazyInit().RequiredNumbers }
|
||||||
func (md *Message) ExtensionRanges() pref.FieldRanges { return &md.lazyInit().ExtensionRanges }
|
func (md *Message) ExtensionRanges() protoreflect.FieldRanges { return &md.lazyInit().ExtensionRanges }
|
||||||
func (md *Message) ExtensionRangeOptions(i int) pref.ProtoMessage {
|
func (md *Message) ExtensionRangeOptions(i int) protoreflect.ProtoMessage {
|
||||||
if f := md.lazyInit().ExtensionRangeOptions[i]; f != nil {
|
if f := md.lazyInit().ExtensionRangeOptions[i]; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.ExtensionRange
|
return descopts.ExtensionRange
|
||||||
}
|
}
|
||||||
func (md *Message) Enums() pref.EnumDescriptors { return &md.L1.Enums }
|
func (md *Message) Enums() protoreflect.EnumDescriptors { return &md.L1.Enums }
|
||||||
func (md *Message) Messages() pref.MessageDescriptors { return &md.L1.Messages }
|
func (md *Message) Messages() protoreflect.MessageDescriptors { return &md.L1.Messages }
|
||||||
func (md *Message) Extensions() pref.ExtensionDescriptors { return &md.L1.Extensions }
|
func (md *Message) Extensions() protoreflect.ExtensionDescriptors { return &md.L1.Extensions }
|
||||||
func (md *Message) ProtoType(pref.MessageDescriptor) {}
|
func (md *Message) ProtoType(protoreflect.MessageDescriptor) {}
|
||||||
func (md *Message) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
|
func (md *Message) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
|
||||||
func (md *Message) lazyInit() *MessageL2 {
|
func (md *Message) lazyInit() *MessageL2 {
|
||||||
md.L0.ParentFile.lazyInit() // implicitly initializes L2
|
md.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||||
return md.L2
|
return md.L2
|
||||||
|
|
@ -260,70 +316,75 @@ func (md *Message) IsMessageSet() bool {
|
||||||
return md.L1.IsMessageSet
|
return md.L1.IsMessageSet
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fd *Field) Options() pref.ProtoMessage {
|
func (fd *Field) Options() protoreflect.ProtoMessage {
|
||||||
if f := fd.L1.Options; f != nil {
|
if f := fd.L1.Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Field
|
return descopts.Field
|
||||||
}
|
}
|
||||||
func (fd *Field) Number() pref.FieldNumber { return fd.L1.Number }
|
func (fd *Field) Number() protoreflect.FieldNumber { return fd.L1.Number }
|
||||||
func (fd *Field) Cardinality() pref.Cardinality { return fd.L1.Cardinality }
|
func (fd *Field) Cardinality() protoreflect.Cardinality { return fd.L1.Cardinality }
|
||||||
func (fd *Field) Kind() pref.Kind { return fd.L1.Kind }
|
func (fd *Field) Kind() protoreflect.Kind {
|
||||||
func (fd *Field) HasJSONName() bool { return fd.L1.StringName.hasJSON }
|
return fd.L1.Kind
|
||||||
func (fd *Field) JSONName() string { return fd.L1.StringName.getJSON(fd) }
|
}
|
||||||
func (fd *Field) TextName() string { return fd.L1.StringName.getText(fd) }
|
func (fd *Field) HasJSONName() bool { return fd.L1.StringName.hasJSON }
|
||||||
|
func (fd *Field) JSONName() string { return fd.L1.StringName.getJSON(fd) }
|
||||||
|
func (fd *Field) TextName() string { return fd.L1.StringName.getText(fd) }
|
||||||
func (fd *Field) HasPresence() bool {
|
func (fd *Field) HasPresence() bool {
|
||||||
return fd.L1.Cardinality != pref.Repeated && (fd.L0.ParentFile.L1.Syntax == pref.Proto2 || fd.L1.Message != nil || fd.L1.ContainingOneof != nil)
|
if fd.L1.Cardinality == protoreflect.Repeated {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return fd.IsExtension() || fd.L1.EditionFeatures.IsFieldPresence || fd.L1.Message != nil || fd.L1.ContainingOneof != nil
|
||||||
}
|
}
|
||||||
func (fd *Field) HasOptionalKeyword() bool {
|
func (fd *Field) HasOptionalKeyword() bool {
|
||||||
return (fd.L0.ParentFile.L1.Syntax == pref.Proto2 && fd.L1.Cardinality == pref.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional
|
return (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional
|
||||||
}
|
}
|
||||||
func (fd *Field) IsPacked() bool {
|
func (fd *Field) IsPacked() bool {
|
||||||
if !fd.L1.HasPacked && fd.L0.ParentFile.L1.Syntax != pref.Proto2 && fd.L1.Cardinality == pref.Repeated {
|
if fd.L1.Cardinality != protoreflect.Repeated {
|
||||||
switch fd.L1.Kind {
|
return false
|
||||||
case pref.StringKind, pref.BytesKind, pref.MessageKind, pref.GroupKind:
|
|
||||||
default:
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return fd.L1.IsPacked
|
switch fd.L1.Kind {
|
||||||
|
case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return fd.L1.EditionFeatures.IsPacked
|
||||||
}
|
}
|
||||||
func (fd *Field) IsExtension() bool { return false }
|
func (fd *Field) IsExtension() bool { return false }
|
||||||
func (fd *Field) IsWeak() bool { return fd.L1.IsWeak }
|
func (fd *Field) IsWeak() bool { return fd.L1.IsWeak }
|
||||||
func (fd *Field) IsList() bool { return fd.Cardinality() == pref.Repeated && !fd.IsMap() }
|
func (fd *Field) IsList() bool { return fd.Cardinality() == protoreflect.Repeated && !fd.IsMap() }
|
||||||
func (fd *Field) IsMap() bool { return fd.Message() != nil && fd.Message().IsMapEntry() }
|
func (fd *Field) IsMap() bool { return fd.Message() != nil && fd.Message().IsMapEntry() }
|
||||||
func (fd *Field) MapKey() pref.FieldDescriptor {
|
func (fd *Field) MapKey() protoreflect.FieldDescriptor {
|
||||||
if !fd.IsMap() {
|
if !fd.IsMap() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return fd.Message().Fields().ByNumber(genid.MapEntry_Key_field_number)
|
return fd.Message().Fields().ByNumber(genid.MapEntry_Key_field_number)
|
||||||
}
|
}
|
||||||
func (fd *Field) MapValue() pref.FieldDescriptor {
|
func (fd *Field) MapValue() protoreflect.FieldDescriptor {
|
||||||
if !fd.IsMap() {
|
if !fd.IsMap() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return fd.Message().Fields().ByNumber(genid.MapEntry_Value_field_number)
|
return fd.Message().Fields().ByNumber(genid.MapEntry_Value_field_number)
|
||||||
}
|
}
|
||||||
func (fd *Field) HasDefault() bool { return fd.L1.Default.has }
|
func (fd *Field) HasDefault() bool { return fd.L1.Default.has }
|
||||||
func (fd *Field) Default() pref.Value { return fd.L1.Default.get(fd) }
|
func (fd *Field) Default() protoreflect.Value { return fd.L1.Default.get(fd) }
|
||||||
func (fd *Field) DefaultEnumValue() pref.EnumValueDescriptor { return fd.L1.Default.enum }
|
func (fd *Field) DefaultEnumValue() protoreflect.EnumValueDescriptor { return fd.L1.Default.enum }
|
||||||
func (fd *Field) ContainingOneof() pref.OneofDescriptor { return fd.L1.ContainingOneof }
|
func (fd *Field) ContainingOneof() protoreflect.OneofDescriptor { return fd.L1.ContainingOneof }
|
||||||
func (fd *Field) ContainingMessage() pref.MessageDescriptor {
|
func (fd *Field) ContainingMessage() protoreflect.MessageDescriptor {
|
||||||
return fd.L0.Parent.(pref.MessageDescriptor)
|
return fd.L0.Parent.(protoreflect.MessageDescriptor)
|
||||||
}
|
}
|
||||||
func (fd *Field) Enum() pref.EnumDescriptor {
|
func (fd *Field) Enum() protoreflect.EnumDescriptor {
|
||||||
return fd.L1.Enum
|
return fd.L1.Enum
|
||||||
}
|
}
|
||||||
func (fd *Field) Message() pref.MessageDescriptor {
|
func (fd *Field) Message() protoreflect.MessageDescriptor {
|
||||||
if fd.L1.IsWeak {
|
if fd.L1.IsWeak {
|
||||||
if d, _ := protoregistry.GlobalFiles.FindDescriptorByName(fd.L1.Message.FullName()); d != nil {
|
if d, _ := protoregistry.GlobalFiles.FindDescriptorByName(fd.L1.Message.FullName()); d != nil {
|
||||||
return d.(pref.MessageDescriptor)
|
return d.(protoreflect.MessageDescriptor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fd.L1.Message
|
return fd.L1.Message
|
||||||
}
|
}
|
||||||
func (fd *Field) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
|
func (fd *Field) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
|
||||||
func (fd *Field) ProtoType(pref.FieldDescriptor) {}
|
func (fd *Field) ProtoType(protoreflect.FieldDescriptor) {}
|
||||||
|
|
||||||
// EnforceUTF8 is a pseudo-internal API to determine whether to enforce UTF-8
|
// EnforceUTF8 is a pseudo-internal API to determine whether to enforce UTF-8
|
||||||
// validation for the string field. This exists for Google-internal use only
|
// validation for the string field. This exists for Google-internal use only
|
||||||
|
|
@ -333,24 +394,21 @@ func (fd *Field) ProtoType(pref.FieldDescriptor) {}
|
||||||
// WARNING: This method is exempt from the compatibility promise and may be
|
// WARNING: This method is exempt from the compatibility promise and may be
|
||||||
// removed in the future without warning.
|
// removed in the future without warning.
|
||||||
func (fd *Field) EnforceUTF8() bool {
|
func (fd *Field) EnforceUTF8() bool {
|
||||||
if fd.L1.HasEnforceUTF8 {
|
return fd.L1.EditionFeatures.IsUTF8Validated
|
||||||
return fd.L1.EnforceUTF8
|
|
||||||
}
|
|
||||||
return fd.L0.ParentFile.L1.Syntax == pref.Proto3
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (od *Oneof) IsSynthetic() bool {
|
func (od *Oneof) IsSynthetic() bool {
|
||||||
return od.L0.ParentFile.L1.Syntax == pref.Proto3 && len(od.L1.Fields.List) == 1 && od.L1.Fields.List[0].HasOptionalKeyword()
|
return od.L0.ParentFile.L1.Syntax == protoreflect.Proto3 && len(od.L1.Fields.List) == 1 && od.L1.Fields.List[0].HasOptionalKeyword()
|
||||||
}
|
}
|
||||||
func (od *Oneof) Options() pref.ProtoMessage {
|
func (od *Oneof) Options() protoreflect.ProtoMessage {
|
||||||
if f := od.L1.Options; f != nil {
|
if f := od.L1.Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Oneof
|
return descopts.Oneof
|
||||||
}
|
}
|
||||||
func (od *Oneof) Fields() pref.FieldDescriptors { return &od.L1.Fields }
|
func (od *Oneof) Fields() protoreflect.FieldDescriptors { return &od.L1.Fields }
|
||||||
func (od *Oneof) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, od) }
|
func (od *Oneof) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, od) }
|
||||||
func (od *Oneof) ProtoType(pref.OneofDescriptor) {}
|
func (od *Oneof) ProtoType(protoreflect.OneofDescriptor) {}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
Extension struct {
|
Extension struct {
|
||||||
|
|
@ -359,55 +417,66 @@ type (
|
||||||
L2 *ExtensionL2 // protected by fileDesc.once
|
L2 *ExtensionL2 // protected by fileDesc.once
|
||||||
}
|
}
|
||||||
ExtensionL1 struct {
|
ExtensionL1 struct {
|
||||||
Number pref.FieldNumber
|
Number protoreflect.FieldNumber
|
||||||
Extendee pref.MessageDescriptor
|
Extendee protoreflect.MessageDescriptor
|
||||||
Cardinality pref.Cardinality
|
Cardinality protoreflect.Cardinality
|
||||||
Kind pref.Kind
|
Kind protoreflect.Kind
|
||||||
|
EditionFeatures EditionFeatures
|
||||||
}
|
}
|
||||||
ExtensionL2 struct {
|
ExtensionL2 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
StringName stringName
|
StringName stringName
|
||||||
IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
|
IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
|
||||||
IsPacked bool // promoted from google.protobuf.FieldOptions
|
|
||||||
Default defaultValue
|
Default defaultValue
|
||||||
Enum pref.EnumDescriptor
|
Enum protoreflect.EnumDescriptor
|
||||||
Message pref.MessageDescriptor
|
Message protoreflect.MessageDescriptor
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (xd *Extension) Options() pref.ProtoMessage {
|
func (xd *Extension) Options() protoreflect.ProtoMessage {
|
||||||
if f := xd.lazyInit().Options; f != nil {
|
if f := xd.lazyInit().Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Field
|
return descopts.Field
|
||||||
}
|
}
|
||||||
func (xd *Extension) Number() pref.FieldNumber { return xd.L1.Number }
|
func (xd *Extension) Number() protoreflect.FieldNumber { return xd.L1.Number }
|
||||||
func (xd *Extension) Cardinality() pref.Cardinality { return xd.L1.Cardinality }
|
func (xd *Extension) Cardinality() protoreflect.Cardinality { return xd.L1.Cardinality }
|
||||||
func (xd *Extension) Kind() pref.Kind { return xd.L1.Kind }
|
func (xd *Extension) Kind() protoreflect.Kind { return xd.L1.Kind }
|
||||||
func (xd *Extension) HasJSONName() bool { return xd.lazyInit().StringName.hasJSON }
|
func (xd *Extension) HasJSONName() bool { return xd.lazyInit().StringName.hasJSON }
|
||||||
func (xd *Extension) JSONName() string { return xd.lazyInit().StringName.getJSON(xd) }
|
func (xd *Extension) JSONName() string { return xd.lazyInit().StringName.getJSON(xd) }
|
||||||
func (xd *Extension) TextName() string { return xd.lazyInit().StringName.getText(xd) }
|
func (xd *Extension) TextName() string { return xd.lazyInit().StringName.getText(xd) }
|
||||||
func (xd *Extension) HasPresence() bool { return xd.L1.Cardinality != pref.Repeated }
|
func (xd *Extension) HasPresence() bool { return xd.L1.Cardinality != protoreflect.Repeated }
|
||||||
func (xd *Extension) HasOptionalKeyword() bool {
|
func (xd *Extension) HasOptionalKeyword() bool {
|
||||||
return (xd.L0.ParentFile.L1.Syntax == pref.Proto2 && xd.L1.Cardinality == pref.Optional) || xd.lazyInit().IsProto3Optional
|
return (xd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && xd.L1.Cardinality == protoreflect.Optional) || xd.lazyInit().IsProto3Optional
|
||||||
}
|
}
|
||||||
func (xd *Extension) IsPacked() bool { return xd.lazyInit().IsPacked }
|
func (xd *Extension) IsPacked() bool {
|
||||||
func (xd *Extension) IsExtension() bool { return true }
|
if xd.L1.Cardinality != protoreflect.Repeated {
|
||||||
func (xd *Extension) IsWeak() bool { return false }
|
return false
|
||||||
func (xd *Extension) IsList() bool { return xd.Cardinality() == pref.Repeated }
|
}
|
||||||
func (xd *Extension) IsMap() bool { return false }
|
switch xd.L1.Kind {
|
||||||
func (xd *Extension) MapKey() pref.FieldDescriptor { return nil }
|
case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
func (xd *Extension) MapValue() pref.FieldDescriptor { return nil }
|
return false
|
||||||
func (xd *Extension) HasDefault() bool { return xd.lazyInit().Default.has }
|
}
|
||||||
func (xd *Extension) Default() pref.Value { return xd.lazyInit().Default.get(xd) }
|
return xd.L1.EditionFeatures.IsPacked
|
||||||
func (xd *Extension) DefaultEnumValue() pref.EnumValueDescriptor { return xd.lazyInit().Default.enum }
|
}
|
||||||
func (xd *Extension) ContainingOneof() pref.OneofDescriptor { return nil }
|
func (xd *Extension) IsExtension() bool { return true }
|
||||||
func (xd *Extension) ContainingMessage() pref.MessageDescriptor { return xd.L1.Extendee }
|
func (xd *Extension) IsWeak() bool { return false }
|
||||||
func (xd *Extension) Enum() pref.EnumDescriptor { return xd.lazyInit().Enum }
|
func (xd *Extension) IsList() bool { return xd.Cardinality() == protoreflect.Repeated }
|
||||||
func (xd *Extension) Message() pref.MessageDescriptor { return xd.lazyInit().Message }
|
func (xd *Extension) IsMap() bool { return false }
|
||||||
func (xd *Extension) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, xd) }
|
func (xd *Extension) MapKey() protoreflect.FieldDescriptor { return nil }
|
||||||
func (xd *Extension) ProtoType(pref.FieldDescriptor) {}
|
func (xd *Extension) MapValue() protoreflect.FieldDescriptor { return nil }
|
||||||
func (xd *Extension) ProtoInternal(pragma.DoNotImplement) {}
|
func (xd *Extension) HasDefault() bool { return xd.lazyInit().Default.has }
|
||||||
|
func (xd *Extension) Default() protoreflect.Value { return xd.lazyInit().Default.get(xd) }
|
||||||
|
func (xd *Extension) DefaultEnumValue() protoreflect.EnumValueDescriptor {
|
||||||
|
return xd.lazyInit().Default.enum
|
||||||
|
}
|
||||||
|
func (xd *Extension) ContainingOneof() protoreflect.OneofDescriptor { return nil }
|
||||||
|
func (xd *Extension) ContainingMessage() protoreflect.MessageDescriptor { return xd.L1.Extendee }
|
||||||
|
func (xd *Extension) Enum() protoreflect.EnumDescriptor { return xd.lazyInit().Enum }
|
||||||
|
func (xd *Extension) Message() protoreflect.MessageDescriptor { return xd.lazyInit().Message }
|
||||||
|
func (xd *Extension) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, xd) }
|
||||||
|
func (xd *Extension) ProtoType(protoreflect.FieldDescriptor) {}
|
||||||
|
func (xd *Extension) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
func (xd *Extension) lazyInit() *ExtensionL2 {
|
func (xd *Extension) lazyInit() *ExtensionL2 {
|
||||||
xd.L0.ParentFile.lazyInit() // implicitly initializes L2
|
xd.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||||
return xd.L2
|
return xd.L2
|
||||||
|
|
@ -421,7 +490,7 @@ type (
|
||||||
}
|
}
|
||||||
ServiceL1 struct{}
|
ServiceL1 struct{}
|
||||||
ServiceL2 struct {
|
ServiceL2 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Methods Methods
|
Methods Methods
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -430,48 +499,49 @@ type (
|
||||||
L1 MethodL1
|
L1 MethodL1
|
||||||
}
|
}
|
||||||
MethodL1 struct {
|
MethodL1 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Input pref.MessageDescriptor
|
Input protoreflect.MessageDescriptor
|
||||||
Output pref.MessageDescriptor
|
Output protoreflect.MessageDescriptor
|
||||||
IsStreamingClient bool
|
IsStreamingClient bool
|
||||||
IsStreamingServer bool
|
IsStreamingServer bool
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (sd *Service) Options() pref.ProtoMessage {
|
func (sd *Service) Options() protoreflect.ProtoMessage {
|
||||||
if f := sd.lazyInit().Options; f != nil {
|
if f := sd.lazyInit().Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Service
|
return descopts.Service
|
||||||
}
|
}
|
||||||
func (sd *Service) Methods() pref.MethodDescriptors { return &sd.lazyInit().Methods }
|
func (sd *Service) Methods() protoreflect.MethodDescriptors { return &sd.lazyInit().Methods }
|
||||||
func (sd *Service) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, sd) }
|
func (sd *Service) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, sd) }
|
||||||
func (sd *Service) ProtoType(pref.ServiceDescriptor) {}
|
func (sd *Service) ProtoType(protoreflect.ServiceDescriptor) {}
|
||||||
func (sd *Service) ProtoInternal(pragma.DoNotImplement) {}
|
func (sd *Service) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
func (sd *Service) lazyInit() *ServiceL2 {
|
func (sd *Service) lazyInit() *ServiceL2 {
|
||||||
sd.L0.ParentFile.lazyInit() // implicitly initializes L2
|
sd.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||||
return sd.L2
|
return sd.L2
|
||||||
}
|
}
|
||||||
|
|
||||||
func (md *Method) Options() pref.ProtoMessage {
|
func (md *Method) Options() protoreflect.ProtoMessage {
|
||||||
if f := md.L1.Options; f != nil {
|
if f := md.L1.Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Method
|
return descopts.Method
|
||||||
}
|
}
|
||||||
func (md *Method) Input() pref.MessageDescriptor { return md.L1.Input }
|
func (md *Method) Input() protoreflect.MessageDescriptor { return md.L1.Input }
|
||||||
func (md *Method) Output() pref.MessageDescriptor { return md.L1.Output }
|
func (md *Method) Output() protoreflect.MessageDescriptor { return md.L1.Output }
|
||||||
func (md *Method) IsStreamingClient() bool { return md.L1.IsStreamingClient }
|
func (md *Method) IsStreamingClient() bool { return md.L1.IsStreamingClient }
|
||||||
func (md *Method) IsStreamingServer() bool { return md.L1.IsStreamingServer }
|
func (md *Method) IsStreamingServer() bool { return md.L1.IsStreamingServer }
|
||||||
func (md *Method) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
|
func (md *Method) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
|
||||||
func (md *Method) ProtoType(pref.MethodDescriptor) {}
|
func (md *Method) ProtoType(protoreflect.MethodDescriptor) {}
|
||||||
func (md *Method) ProtoInternal(pragma.DoNotImplement) {}
|
func (md *Method) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
|
|
||||||
// Surrogate files are can be used to create standalone descriptors
|
// Surrogate files are can be used to create standalone descriptors
|
||||||
// where the syntax is only information derived from the parent file.
|
// where the syntax is only information derived from the parent file.
|
||||||
var (
|
var (
|
||||||
SurrogateProto2 = &File{L1: FileL1{Syntax: pref.Proto2}, L2: &FileL2{}}
|
SurrogateProto2 = &File{L1: FileL1{Syntax: protoreflect.Proto2}, L2: &FileL2{}}
|
||||||
SurrogateProto3 = &File{L1: FileL1{Syntax: pref.Proto3}, L2: &FileL2{}}
|
SurrogateProto3 = &File{L1: FileL1{Syntax: protoreflect.Proto3}, L2: &FileL2{}}
|
||||||
|
SurrogateEdition2023 = &File{L1: FileL1{Syntax: protoreflect.Editions, Edition: Edition2023}, L2: &FileL2{}}
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
@ -479,24 +549,24 @@ type (
|
||||||
L0 BaseL0
|
L0 BaseL0
|
||||||
}
|
}
|
||||||
BaseL0 struct {
|
BaseL0 struct {
|
||||||
FullName pref.FullName // must be populated
|
FullName protoreflect.FullName // must be populated
|
||||||
ParentFile *File // must be populated
|
ParentFile *File // must be populated
|
||||||
Parent pref.Descriptor
|
Parent protoreflect.Descriptor
|
||||||
Index int
|
Index int
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (d *Base) Name() pref.Name { return d.L0.FullName.Name() }
|
func (d *Base) Name() protoreflect.Name { return d.L0.FullName.Name() }
|
||||||
func (d *Base) FullName() pref.FullName { return d.L0.FullName }
|
func (d *Base) FullName() protoreflect.FullName { return d.L0.FullName }
|
||||||
func (d *Base) ParentFile() pref.FileDescriptor {
|
func (d *Base) ParentFile() protoreflect.FileDescriptor {
|
||||||
if d.L0.ParentFile == SurrogateProto2 || d.L0.ParentFile == SurrogateProto3 {
|
if d.L0.ParentFile == SurrogateProto2 || d.L0.ParentFile == SurrogateProto3 {
|
||||||
return nil // surrogate files are not real parents
|
return nil // surrogate files are not real parents
|
||||||
}
|
}
|
||||||
return d.L0.ParentFile
|
return d.L0.ParentFile
|
||||||
}
|
}
|
||||||
func (d *Base) Parent() pref.Descriptor { return d.L0.Parent }
|
func (d *Base) Parent() protoreflect.Descriptor { return d.L0.Parent }
|
||||||
func (d *Base) Index() int { return d.L0.Index }
|
func (d *Base) Index() int { return d.L0.Index }
|
||||||
func (d *Base) Syntax() pref.Syntax { return d.L0.ParentFile.Syntax() }
|
func (d *Base) Syntax() protoreflect.Syntax { return d.L0.ParentFile.Syntax() }
|
||||||
func (d *Base) IsPlaceholder() bool { return false }
|
func (d *Base) IsPlaceholder() bool { return false }
|
||||||
func (d *Base) ProtoInternal(pragma.DoNotImplement) {}
|
func (d *Base) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
|
|
||||||
|
|
@ -513,7 +583,35 @@ func (s *stringName) InitJSON(name string) {
|
||||||
s.nameJSON = name
|
s.nameJSON = name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stringName) lazyInit(fd pref.FieldDescriptor) *stringName {
|
// Returns true if this field is structured like the synthetic field of a proto2
|
||||||
|
// group. This allows us to expand our treatment of delimited fields without
|
||||||
|
// breaking proto2 files that have been upgraded to editions.
|
||||||
|
func isGroupLike(fd protoreflect.FieldDescriptor) bool {
|
||||||
|
// Groups are always group types.
|
||||||
|
if fd.Kind() != protoreflect.GroupKind {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Group fields are always the lowercase type name.
|
||||||
|
if strings.ToLower(string(fd.Message().Name())) != string(fd.Name()) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Groups could only be defined in the same file they're used.
|
||||||
|
if fd.Message().ParentFile() != fd.ParentFile() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Group messages are always defined in the same scope as the field. File
|
||||||
|
// level extensions will compare NULL == NULL here, which is why the file
|
||||||
|
// comparison above is necessary to ensure both come from the same file.
|
||||||
|
if fd.IsExtension() {
|
||||||
|
return fd.Parent() == fd.Message().Parent()
|
||||||
|
}
|
||||||
|
return fd.ContainingMessage() == fd.Message().Parent()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stringName) lazyInit(fd protoreflect.FieldDescriptor) *stringName {
|
||||||
s.once.Do(func() {
|
s.once.Do(func() {
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
// For extensions, JSON and text are formatted the same way.
|
// For extensions, JSON and text are formatted the same way.
|
||||||
|
|
@ -533,7 +631,7 @@ func (s *stringName) lazyInit(fd pref.FieldDescriptor) *stringName {
|
||||||
|
|
||||||
// Format the text name.
|
// Format the text name.
|
||||||
s.nameText = string(fd.Name())
|
s.nameText = string(fd.Name())
|
||||||
if fd.Kind() == pref.GroupKind {
|
if isGroupLike(fd) {
|
||||||
s.nameText = string(fd.Message().Name())
|
s.nameText = string(fd.Message().Name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -541,10 +639,10 @@ func (s *stringName) lazyInit(fd pref.FieldDescriptor) *stringName {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stringName) getJSON(fd pref.FieldDescriptor) string { return s.lazyInit(fd).nameJSON }
|
func (s *stringName) getJSON(fd protoreflect.FieldDescriptor) string { return s.lazyInit(fd).nameJSON }
|
||||||
func (s *stringName) getText(fd pref.FieldDescriptor) string { return s.lazyInit(fd).nameText }
|
func (s *stringName) getText(fd protoreflect.FieldDescriptor) string { return s.lazyInit(fd).nameText }
|
||||||
|
|
||||||
func DefaultValue(v pref.Value, ev pref.EnumValueDescriptor) defaultValue {
|
func DefaultValue(v protoreflect.Value, ev protoreflect.EnumValueDescriptor) defaultValue {
|
||||||
dv := defaultValue{has: v.IsValid(), val: v, enum: ev}
|
dv := defaultValue{has: v.IsValid(), val: v, enum: ev}
|
||||||
if b, ok := v.Interface().([]byte); ok {
|
if b, ok := v.Interface().([]byte); ok {
|
||||||
// Store a copy of the default bytes, so that we can detect
|
// Store a copy of the default bytes, so that we can detect
|
||||||
|
|
@ -554,9 +652,9 @@ func DefaultValue(v pref.Value, ev pref.EnumValueDescriptor) defaultValue {
|
||||||
return dv
|
return dv
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalDefault(b []byte, k pref.Kind, pf *File, ed pref.EnumDescriptor) defaultValue {
|
func unmarshalDefault(b []byte, k protoreflect.Kind, pf *File, ed protoreflect.EnumDescriptor) defaultValue {
|
||||||
var evs pref.EnumValueDescriptors
|
var evs protoreflect.EnumValueDescriptors
|
||||||
if k == pref.EnumKind {
|
if k == protoreflect.EnumKind {
|
||||||
// If the enum is declared within the same file, be careful not to
|
// If the enum is declared within the same file, be careful not to
|
||||||
// blindly call the Values method, lest we bind ourselves in a deadlock.
|
// blindly call the Values method, lest we bind ourselves in a deadlock.
|
||||||
if e, ok := ed.(*Enum); ok && e.L0.ParentFile == pf {
|
if e, ok := ed.(*Enum); ok && e.L0.ParentFile == pf {
|
||||||
|
|
@ -567,9 +665,9 @@ func unmarshalDefault(b []byte, k pref.Kind, pf *File, ed pref.EnumDescriptor) d
|
||||||
|
|
||||||
// If we are unable to resolve the enum dependency, use a placeholder
|
// If we are unable to resolve the enum dependency, use a placeholder
|
||||||
// enum value since we will not be able to parse the default value.
|
// enum value since we will not be able to parse the default value.
|
||||||
if ed.IsPlaceholder() && pref.Name(b).IsValid() {
|
if ed.IsPlaceholder() && protoreflect.Name(b).IsValid() {
|
||||||
v := pref.ValueOfEnum(0)
|
v := protoreflect.ValueOfEnum(0)
|
||||||
ev := PlaceholderEnumValue(ed.FullName().Parent().Append(pref.Name(b)))
|
ev := PlaceholderEnumValue(ed.FullName().Parent().Append(protoreflect.Name(b)))
|
||||||
return DefaultValue(v, ev)
|
return DefaultValue(v, ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -583,41 +681,41 @@ func unmarshalDefault(b []byte, k pref.Kind, pf *File, ed pref.EnumDescriptor) d
|
||||||
|
|
||||||
type defaultValue struct {
|
type defaultValue struct {
|
||||||
has bool
|
has bool
|
||||||
val pref.Value
|
val protoreflect.Value
|
||||||
enum pref.EnumValueDescriptor
|
enum protoreflect.EnumValueDescriptor
|
||||||
bytes []byte
|
bytes []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dv *defaultValue) get(fd pref.FieldDescriptor) pref.Value {
|
func (dv *defaultValue) get(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
// Return the zero value as the default if unpopulated.
|
// Return the zero value as the default if unpopulated.
|
||||||
if !dv.has {
|
if !dv.has {
|
||||||
if fd.Cardinality() == pref.Repeated {
|
if fd.Cardinality() == protoreflect.Repeated {
|
||||||
return pref.Value{}
|
return protoreflect.Value{}
|
||||||
}
|
}
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
return pref.ValueOfBool(false)
|
return protoreflect.ValueOfBool(false)
|
||||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||||
return pref.ValueOfInt32(0)
|
return protoreflect.ValueOfInt32(0)
|
||||||
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||||
return pref.ValueOfInt64(0)
|
return protoreflect.ValueOfInt64(0)
|
||||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||||
return pref.ValueOfUint32(0)
|
return protoreflect.ValueOfUint32(0)
|
||||||
case pref.Uint64Kind, pref.Fixed64Kind:
|
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||||
return pref.ValueOfUint64(0)
|
return protoreflect.ValueOfUint64(0)
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
return pref.ValueOfFloat32(0)
|
return protoreflect.ValueOfFloat32(0)
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
return pref.ValueOfFloat64(0)
|
return protoreflect.ValueOfFloat64(0)
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
return pref.ValueOfString("")
|
return protoreflect.ValueOfString("")
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
return pref.ValueOfBytes(nil)
|
return protoreflect.ValueOfBytes(nil)
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if evs := fd.Enum().Values(); evs.Len() > 0 {
|
if evs := fd.Enum().Values(); evs.Len() > 0 {
|
||||||
return pref.ValueOfEnum(evs.Get(0).Number())
|
return protoreflect.ValueOfEnum(evs.Get(0).Number())
|
||||||
}
|
}
|
||||||
return pref.ValueOfEnum(0)
|
return protoreflect.ValueOfEnum(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
123
vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
generated
vendored
123
vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
generated
vendored
|
|
@ -5,12 +5,13 @@
|
||||||
package filedesc
|
package filedesc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fileRaw is a data struct used when initializing a file descriptor from
|
// fileRaw is a data struct used when initializing a file descriptor from
|
||||||
|
|
@ -95,9 +96,10 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||||
sb := getBuilder()
|
sb := getBuilder()
|
||||||
defer putBuilder(sb)
|
defer putBuilder(sb)
|
||||||
|
|
||||||
var prevField pref.FieldNumber
|
var prevField protoreflect.FieldNumber
|
||||||
var numEnums, numMessages, numExtensions, numServices int
|
var numEnums, numMessages, numExtensions, numServices int
|
||||||
var posEnums, posMessages, posExtensions, posServices int
|
var posEnums, posMessages, posExtensions, posServices int
|
||||||
|
var options []byte
|
||||||
b0 := b
|
b0 := b
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
num, typ, n := protowire.ConsumeTag(b)
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
|
|
@ -110,16 +112,22 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||||
case genid.FileDescriptorProto_Syntax_field_number:
|
case genid.FileDescriptorProto_Syntax_field_number:
|
||||||
switch string(v) {
|
switch string(v) {
|
||||||
case "proto2":
|
case "proto2":
|
||||||
fd.L1.Syntax = pref.Proto2
|
fd.L1.Syntax = protoreflect.Proto2
|
||||||
|
fd.L1.Edition = EditionProto2
|
||||||
case "proto3":
|
case "proto3":
|
||||||
fd.L1.Syntax = pref.Proto3
|
fd.L1.Syntax = protoreflect.Proto3
|
||||||
|
fd.L1.Edition = EditionProto3
|
||||||
|
case "editions":
|
||||||
|
fd.L1.Syntax = protoreflect.Editions
|
||||||
default:
|
default:
|
||||||
panic("invalid syntax")
|
panic("invalid syntax")
|
||||||
}
|
}
|
||||||
case genid.FileDescriptorProto_Name_field_number:
|
case genid.FileDescriptorProto_Name_field_number:
|
||||||
fd.L1.Path = sb.MakeString(v)
|
fd.L1.Path = sb.MakeString(v)
|
||||||
case genid.FileDescriptorProto_Package_field_number:
|
case genid.FileDescriptorProto_Package_field_number:
|
||||||
fd.L1.Package = pref.FullName(sb.MakeString(v))
|
fd.L1.Package = protoreflect.FullName(sb.MakeString(v))
|
||||||
|
case genid.FileDescriptorProto_Options_field_number:
|
||||||
|
options = v
|
||||||
case genid.FileDescriptorProto_EnumType_field_number:
|
case genid.FileDescriptorProto_EnumType_field_number:
|
||||||
if prevField != genid.FileDescriptorProto_EnumType_field_number {
|
if prevField != genid.FileDescriptorProto_EnumType_field_number {
|
||||||
if numEnums > 0 {
|
if numEnums > 0 {
|
||||||
|
|
@ -154,6 +162,13 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||||
numServices++
|
numServices++
|
||||||
}
|
}
|
||||||
prevField = num
|
prevField = num
|
||||||
|
case protowire.VarintType:
|
||||||
|
v, m := protowire.ConsumeVarint(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FileDescriptorProto_Edition_field_number:
|
||||||
|
fd.L1.Edition = Edition(v)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
|
|
@ -163,7 +178,15 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||||
|
|
||||||
// If syntax is missing, it is assumed to be proto2.
|
// If syntax is missing, it is assumed to be proto2.
|
||||||
if fd.L1.Syntax == 0 {
|
if fd.L1.Syntax == 0 {
|
||||||
fd.L1.Syntax = pref.Proto2
|
fd.L1.Syntax = protoreflect.Proto2
|
||||||
|
fd.L1.Edition = EditionProto2
|
||||||
|
}
|
||||||
|
|
||||||
|
fd.L1.EditionFeatures = getFeaturesFor(fd.L1.Edition)
|
||||||
|
|
||||||
|
// Parse editions features from options if any
|
||||||
|
if options != nil {
|
||||||
|
fd.unmarshalSeedOptions(options)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must allocate all declarations before parsing each descriptor type
|
// Must allocate all declarations before parsing each descriptor type
|
||||||
|
|
@ -219,10 +242,33 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (fd *File) unmarshalSeedOptions(b []byte) {
|
||||||
|
for b := b; len(b) > 0; {
|
||||||
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
|
b = b[n:]
|
||||||
|
switch typ {
|
||||||
|
case protowire.BytesType:
|
||||||
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FileOptions_Features_field_number:
|
||||||
|
if fd.Syntax() != protoreflect.Editions {
|
||||||
|
panic(fmt.Sprintf("invalid descriptor: using edition features in a proto with syntax %s", fd.Syntax()))
|
||||||
|
}
|
||||||
|
fd.L1.EditionFeatures = unmarshalFeatureSet(v, fd.L1.EditionFeatures)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
|
b = b[m:]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
ed.L0.ParentFile = pf
|
ed.L0.ParentFile = pf
|
||||||
ed.L0.Parent = pd
|
ed.L0.Parent = pd
|
||||||
ed.L0.Index = i
|
ed.L0.Index = i
|
||||||
|
ed.L1.EditionFeatures = featuresFromParentDesc(ed.Parent())
|
||||||
|
|
||||||
var numValues int
|
var numValues int
|
||||||
for b := b; len(b) > 0; {
|
for b := b; len(b) > 0; {
|
||||||
|
|
@ -271,12 +317,13 @@ func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Desc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
md.L0.ParentFile = pf
|
md.L0.ParentFile = pf
|
||||||
md.L0.Parent = pd
|
md.L0.Parent = pd
|
||||||
md.L0.Index = i
|
md.L0.Index = i
|
||||||
|
md.L1.EditionFeatures = featuresFromParentDesc(md.Parent())
|
||||||
|
|
||||||
var prevField pref.FieldNumber
|
var prevField protoreflect.FieldNumber
|
||||||
var numEnums, numMessages, numExtensions int
|
var numEnums, numMessages, numExtensions int
|
||||||
var posEnums, posMessages, posExtensions int
|
var posEnums, posMessages, posExtensions int
|
||||||
b0 := b
|
b0 := b
|
||||||
|
|
@ -380,6 +427,13 @@ func (md *Message) unmarshalSeedOptions(b []byte) {
|
||||||
case genid.MessageOptions_MessageSetWireFormat_field_number:
|
case genid.MessageOptions_MessageSetWireFormat_field_number:
|
||||||
md.L1.IsMessageSet = protowire.DecodeBool(v)
|
md.L1.IsMessageSet = protowire.DecodeBool(v)
|
||||||
}
|
}
|
||||||
|
case protowire.BytesType:
|
||||||
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.MessageOptions_Features_field_number:
|
||||||
|
md.L1.EditionFeatures = unmarshalFeatureSet(v, md.L1.EditionFeatures)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
|
|
@ -387,10 +441,11 @@ func (md *Message) unmarshalSeedOptions(b []byte) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
xd.L0.ParentFile = pf
|
xd.L0.ParentFile = pf
|
||||||
xd.L0.Parent = pd
|
xd.L0.Parent = pd
|
||||||
xd.L0.Index = i
|
xd.L0.Index = i
|
||||||
|
xd.L1.EditionFeatures = featuresFromParentDesc(pd)
|
||||||
|
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
num, typ, n := protowire.ConsumeTag(b)
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
|
|
@ -401,11 +456,11 @@ func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case genid.FieldDescriptorProto_Number_field_number:
|
case genid.FieldDescriptorProto_Number_field_number:
|
||||||
xd.L1.Number = pref.FieldNumber(v)
|
xd.L1.Number = protoreflect.FieldNumber(v)
|
||||||
case genid.FieldDescriptorProto_Label_field_number:
|
case genid.FieldDescriptorProto_Label_field_number:
|
||||||
xd.L1.Cardinality = pref.Cardinality(v)
|
xd.L1.Cardinality = protoreflect.Cardinality(v)
|
||||||
case genid.FieldDescriptorProto_Type_field_number:
|
case genid.FieldDescriptorProto_Type_field_number:
|
||||||
xd.L1.Kind = pref.Kind(v)
|
xd.L1.Kind = protoreflect.Kind(v)
|
||||||
}
|
}
|
||||||
case protowire.BytesType:
|
case protowire.BytesType:
|
||||||
v, m := protowire.ConsumeBytes(b)
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
|
@ -415,6 +470,38 @@ func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref
|
||||||
xd.L0.FullName = appendFullName(sb, pd.FullName(), v)
|
xd.L0.FullName = appendFullName(sb, pd.FullName(), v)
|
||||||
case genid.FieldDescriptorProto_Extendee_field_number:
|
case genid.FieldDescriptorProto_Extendee_field_number:
|
||||||
xd.L1.Extendee = PlaceholderMessage(makeFullName(sb, v))
|
xd.L1.Extendee = PlaceholderMessage(makeFullName(sb, v))
|
||||||
|
case genid.FieldDescriptorProto_Options_field_number:
|
||||||
|
xd.unmarshalOptions(v)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
|
b = b[m:]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if xd.L1.Kind == protoreflect.MessageKind && xd.L1.EditionFeatures.IsDelimitedEncoded {
|
||||||
|
xd.L1.Kind = protoreflect.GroupKind
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (xd *Extension) unmarshalOptions(b []byte) {
|
||||||
|
for len(b) > 0 {
|
||||||
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
|
b = b[n:]
|
||||||
|
switch typ {
|
||||||
|
case protowire.VarintType:
|
||||||
|
v, m := protowire.ConsumeVarint(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FieldOptions_Packed_field_number:
|
||||||
|
xd.L1.EditionFeatures.IsPacked = protowire.DecodeBool(v)
|
||||||
|
}
|
||||||
|
case protowire.BytesType:
|
||||||
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FieldOptions_Features_field_number:
|
||||||
|
xd.L1.EditionFeatures = unmarshalFeatureSet(v, xd.L1.EditionFeatures)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
|
|
@ -423,7 +510,7 @@ func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sd *Service) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (sd *Service) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
sd.L0.ParentFile = pf
|
sd.L0.ParentFile = pf
|
||||||
sd.L0.Parent = pd
|
sd.L0.Parent = pd
|
||||||
sd.L0.Index = i
|
sd.L0.Index = i
|
||||||
|
|
@ -459,13 +546,13 @@ func putBuilder(b *strs.Builder) {
|
||||||
|
|
||||||
// makeFullName converts b to a protoreflect.FullName,
|
// makeFullName converts b to a protoreflect.FullName,
|
||||||
// where b must start with a leading dot.
|
// where b must start with a leading dot.
|
||||||
func makeFullName(sb *strs.Builder, b []byte) pref.FullName {
|
func makeFullName(sb *strs.Builder, b []byte) protoreflect.FullName {
|
||||||
if len(b) == 0 || b[0] != '.' {
|
if len(b) == 0 || b[0] != '.' {
|
||||||
panic("name reference must be fully qualified")
|
panic("name reference must be fully qualified")
|
||||||
}
|
}
|
||||||
return pref.FullName(sb.MakeString(b[1:]))
|
return protoreflect.FullName(sb.MakeString(b[1:]))
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendFullName(sb *strs.Builder, prefix pref.FullName, suffix []byte) pref.FullName {
|
func appendFullName(sb *strs.Builder, prefix protoreflect.FullName, suffix []byte) protoreflect.FullName {
|
||||||
return sb.AppendFullName(prefix, pref.Name(strs.UnsafeString(suffix)))
|
return sb.AppendFullName(prefix, protoreflect.Name(strs.UnsafeString(suffix)))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
120
vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
generated
vendored
120
vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
generated
vendored
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (fd *File) lazyRawInit() {
|
func (fd *File) lazyRawInit() {
|
||||||
|
|
@ -39,10 +39,10 @@ func (file *File) resolveMessages() {
|
||||||
|
|
||||||
// Resolve message field dependency.
|
// Resolve message field dependency.
|
||||||
switch fd.L1.Kind {
|
switch fd.L1.Kind {
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
fd.L1.Enum = file.resolveEnumDependency(fd.L1.Enum, listFieldDeps, depIdx)
|
fd.L1.Enum = file.resolveEnumDependency(fd.L1.Enum, listFieldDeps, depIdx)
|
||||||
depIdx++
|
depIdx++
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
fd.L1.Message = file.resolveMessageDependency(fd.L1.Message, listFieldDeps, depIdx)
|
fd.L1.Message = file.resolveMessageDependency(fd.L1.Message, listFieldDeps, depIdx)
|
||||||
depIdx++
|
depIdx++
|
||||||
}
|
}
|
||||||
|
|
@ -62,10 +62,10 @@ func (file *File) resolveExtensions() {
|
||||||
|
|
||||||
// Resolve extension field dependency.
|
// Resolve extension field dependency.
|
||||||
switch xd.L1.Kind {
|
switch xd.L1.Kind {
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
xd.L2.Enum = file.resolveEnumDependency(xd.L2.Enum, listExtDeps, depIdx)
|
xd.L2.Enum = file.resolveEnumDependency(xd.L2.Enum, listExtDeps, depIdx)
|
||||||
depIdx++
|
depIdx++
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
xd.L2.Message = file.resolveMessageDependency(xd.L2.Message, listExtDeps, depIdx)
|
xd.L2.Message = file.resolveMessageDependency(xd.L2.Message, listExtDeps, depIdx)
|
||||||
depIdx++
|
depIdx++
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +92,7 @@ func (file *File) resolveServices() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (file *File) resolveEnumDependency(ed pref.EnumDescriptor, i, j int32) pref.EnumDescriptor {
|
func (file *File) resolveEnumDependency(ed protoreflect.EnumDescriptor, i, j int32) protoreflect.EnumDescriptor {
|
||||||
r := file.builder.FileRegistry
|
r := file.builder.FileRegistry
|
||||||
if r, ok := r.(resolverByIndex); ok {
|
if r, ok := r.(resolverByIndex); ok {
|
||||||
if ed2 := r.FindEnumByIndex(i, j, file.allEnums, file.allMessages); ed2 != nil {
|
if ed2 := r.FindEnumByIndex(i, j, file.allEnums, file.allMessages); ed2 != nil {
|
||||||
|
|
@ -105,12 +105,12 @@ func (file *File) resolveEnumDependency(ed pref.EnumDescriptor, i, j int32) pref
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if d, _ := r.FindDescriptorByName(ed.FullName()); d != nil {
|
if d, _ := r.FindDescriptorByName(ed.FullName()); d != nil {
|
||||||
return d.(pref.EnumDescriptor)
|
return d.(protoreflect.EnumDescriptor)
|
||||||
}
|
}
|
||||||
return ed
|
return ed
|
||||||
}
|
}
|
||||||
|
|
||||||
func (file *File) resolveMessageDependency(md pref.MessageDescriptor, i, j int32) pref.MessageDescriptor {
|
func (file *File) resolveMessageDependency(md protoreflect.MessageDescriptor, i, j int32) protoreflect.MessageDescriptor {
|
||||||
r := file.builder.FileRegistry
|
r := file.builder.FileRegistry
|
||||||
if r, ok := r.(resolverByIndex); ok {
|
if r, ok := r.(resolverByIndex); ok {
|
||||||
if md2 := r.FindMessageByIndex(i, j, file.allEnums, file.allMessages); md2 != nil {
|
if md2 := r.FindMessageByIndex(i, j, file.allEnums, file.allMessages); md2 != nil {
|
||||||
|
|
@ -123,7 +123,7 @@ func (file *File) resolveMessageDependency(md pref.MessageDescriptor, i, j int32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if d, _ := r.FindDescriptorByName(md.FullName()); d != nil {
|
if d, _ := r.FindDescriptorByName(md.FullName()); d != nil {
|
||||||
return d.(pref.MessageDescriptor)
|
return d.(protoreflect.MessageDescriptor)
|
||||||
}
|
}
|
||||||
return md
|
return md
|
||||||
}
|
}
|
||||||
|
|
@ -158,7 +158,7 @@ func (fd *File) unmarshalFull(b []byte) {
|
||||||
if imp == nil {
|
if imp == nil {
|
||||||
imp = PlaceholderFile(path)
|
imp = PlaceholderFile(path)
|
||||||
}
|
}
|
||||||
fd.L2.Imports = append(fd.L2.Imports, pref.FileImport{FileDescriptor: imp})
|
fd.L2.Imports = append(fd.L2.Imports, protoreflect.FileImport{FileDescriptor: imp})
|
||||||
case genid.FileDescriptorProto_EnumType_field_number:
|
case genid.FileDescriptorProto_EnumType_field_number:
|
||||||
fd.L1.Enums.List[enumIdx].unmarshalFull(v, sb)
|
fd.L1.Enums.List[enumIdx].unmarshalFull(v, sb)
|
||||||
enumIdx++
|
enumIdx++
|
||||||
|
|
@ -199,7 +199,7 @@ func (ed *Enum) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||||
case genid.EnumDescriptorProto_Value_field_number:
|
case genid.EnumDescriptorProto_Value_field_number:
|
||||||
rawValues = append(rawValues, v)
|
rawValues = append(rawValues, v)
|
||||||
case genid.EnumDescriptorProto_ReservedName_field_number:
|
case genid.EnumDescriptorProto_ReservedName_field_number:
|
||||||
ed.L2.ReservedNames.List = append(ed.L2.ReservedNames.List, pref.Name(sb.MakeString(v)))
|
ed.L2.ReservedNames.List = append(ed.L2.ReservedNames.List, protoreflect.Name(sb.MakeString(v)))
|
||||||
case genid.EnumDescriptorProto_ReservedRange_field_number:
|
case genid.EnumDescriptorProto_ReservedRange_field_number:
|
||||||
ed.L2.ReservedRanges.List = append(ed.L2.ReservedRanges.List, unmarshalEnumReservedRange(v))
|
ed.L2.ReservedRanges.List = append(ed.L2.ReservedRanges.List, unmarshalEnumReservedRange(v))
|
||||||
case genid.EnumDescriptorProto_Options_field_number:
|
case genid.EnumDescriptorProto_Options_field_number:
|
||||||
|
|
@ -219,7 +219,7 @@ func (ed *Enum) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||||
ed.L2.Options = ed.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Enum, rawOptions)
|
ed.L2.Options = ed.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Enum, rawOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) {
|
func unmarshalEnumReservedRange(b []byte) (r [2]protoreflect.EnumNumber) {
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
num, typ, n := protowire.ConsumeTag(b)
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
b = b[n:]
|
b = b[n:]
|
||||||
|
|
@ -229,9 +229,9 @@ func unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) {
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case genid.EnumDescriptorProto_EnumReservedRange_Start_field_number:
|
case genid.EnumDescriptorProto_EnumReservedRange_Start_field_number:
|
||||||
r[0] = pref.EnumNumber(v)
|
r[0] = protoreflect.EnumNumber(v)
|
||||||
case genid.EnumDescriptorProto_EnumReservedRange_End_field_number:
|
case genid.EnumDescriptorProto_EnumReservedRange_End_field_number:
|
||||||
r[1] = pref.EnumNumber(v)
|
r[1] = protoreflect.EnumNumber(v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
|
|
@ -241,7 +241,7 @@ func unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
func (vd *EnumValue) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (vd *EnumValue) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
vd.L0.ParentFile = pf
|
vd.L0.ParentFile = pf
|
||||||
vd.L0.Parent = pd
|
vd.L0.Parent = pd
|
||||||
vd.L0.Index = i
|
vd.L0.Index = i
|
||||||
|
|
@ -256,7 +256,7 @@ func (vd *EnumValue) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case genid.EnumValueDescriptorProto_Number_field_number:
|
case genid.EnumValueDescriptorProto_Number_field_number:
|
||||||
vd.L1.Number = pref.EnumNumber(v)
|
vd.L1.Number = protoreflect.EnumNumber(v)
|
||||||
}
|
}
|
||||||
case protowire.BytesType:
|
case protowire.BytesType:
|
||||||
v, m := protowire.ConsumeBytes(b)
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
|
@ -294,7 +294,7 @@ func (md *Message) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||||
case genid.DescriptorProto_OneofDecl_field_number:
|
case genid.DescriptorProto_OneofDecl_field_number:
|
||||||
rawOneofs = append(rawOneofs, v)
|
rawOneofs = append(rawOneofs, v)
|
||||||
case genid.DescriptorProto_ReservedName_field_number:
|
case genid.DescriptorProto_ReservedName_field_number:
|
||||||
md.L2.ReservedNames.List = append(md.L2.ReservedNames.List, pref.Name(sb.MakeString(v)))
|
md.L2.ReservedNames.List = append(md.L2.ReservedNames.List, protoreflect.Name(sb.MakeString(v)))
|
||||||
case genid.DescriptorProto_ReservedRange_field_number:
|
case genid.DescriptorProto_ReservedRange_field_number:
|
||||||
md.L2.ReservedRanges.List = append(md.L2.ReservedRanges.List, unmarshalMessageReservedRange(v))
|
md.L2.ReservedRanges.List = append(md.L2.ReservedRanges.List, unmarshalMessageReservedRange(v))
|
||||||
case genid.DescriptorProto_ExtensionRange_field_number:
|
case genid.DescriptorProto_ExtensionRange_field_number:
|
||||||
|
|
@ -326,7 +326,7 @@ func (md *Message) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||||
for i, b := range rawFields {
|
for i, b := range rawFields {
|
||||||
fd := &md.L2.Fields.List[i]
|
fd := &md.L2.Fields.List[i]
|
||||||
fd.unmarshalFull(b, sb, md.L0.ParentFile, md, i)
|
fd.unmarshalFull(b, sb, md.L0.ParentFile, md, i)
|
||||||
if fd.L1.Cardinality == pref.Required {
|
if fd.L1.Cardinality == protoreflect.Required {
|
||||||
md.L2.RequiredNumbers.List = append(md.L2.RequiredNumbers.List, fd.L1.Number)
|
md.L2.RequiredNumbers.List = append(md.L2.RequiredNumbers.List, fd.L1.Number)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -359,7 +359,7 @@ func (md *Message) unmarshalOptions(b []byte) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) {
|
func unmarshalMessageReservedRange(b []byte) (r [2]protoreflect.FieldNumber) {
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
num, typ, n := protowire.ConsumeTag(b)
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
b = b[n:]
|
b = b[n:]
|
||||||
|
|
@ -369,9 +369,9 @@ func unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) {
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case genid.DescriptorProto_ReservedRange_Start_field_number:
|
case genid.DescriptorProto_ReservedRange_Start_field_number:
|
||||||
r[0] = pref.FieldNumber(v)
|
r[0] = protoreflect.FieldNumber(v)
|
||||||
case genid.DescriptorProto_ReservedRange_End_field_number:
|
case genid.DescriptorProto_ReservedRange_End_field_number:
|
||||||
r[1] = pref.FieldNumber(v)
|
r[1] = protoreflect.FieldNumber(v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
|
|
@ -381,7 +381,7 @@ func unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, rawOptions []byte) {
|
func unmarshalMessageExtensionRange(b []byte) (r [2]protoreflect.FieldNumber, rawOptions []byte) {
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
num, typ, n := protowire.ConsumeTag(b)
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
b = b[n:]
|
b = b[n:]
|
||||||
|
|
@ -391,9 +391,9 @@ func unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, rawOptions
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case genid.DescriptorProto_ExtensionRange_Start_field_number:
|
case genid.DescriptorProto_ExtensionRange_Start_field_number:
|
||||||
r[0] = pref.FieldNumber(v)
|
r[0] = protoreflect.FieldNumber(v)
|
||||||
case genid.DescriptorProto_ExtensionRange_End_field_number:
|
case genid.DescriptorProto_ExtensionRange_End_field_number:
|
||||||
r[1] = pref.FieldNumber(v)
|
r[1] = protoreflect.FieldNumber(v)
|
||||||
}
|
}
|
||||||
case protowire.BytesType:
|
case protowire.BytesType:
|
||||||
v, m := protowire.ConsumeBytes(b)
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
|
@ -410,10 +410,11 @@ func unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, rawOptions
|
||||||
return r, rawOptions
|
return r, rawOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
fd.L0.ParentFile = pf
|
fd.L0.ParentFile = pf
|
||||||
fd.L0.Parent = pd
|
fd.L0.Parent = pd
|
||||||
fd.L0.Index = i
|
fd.L0.Index = i
|
||||||
|
fd.L1.EditionFeatures = featuresFromParentDesc(fd.Parent())
|
||||||
|
|
||||||
var rawTypeName []byte
|
var rawTypeName []byte
|
||||||
var rawOptions []byte
|
var rawOptions []byte
|
||||||
|
|
@ -426,11 +427,11 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Des
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case genid.FieldDescriptorProto_Number_field_number:
|
case genid.FieldDescriptorProto_Number_field_number:
|
||||||
fd.L1.Number = pref.FieldNumber(v)
|
fd.L1.Number = protoreflect.FieldNumber(v)
|
||||||
case genid.FieldDescriptorProto_Label_field_number:
|
case genid.FieldDescriptorProto_Label_field_number:
|
||||||
fd.L1.Cardinality = pref.Cardinality(v)
|
fd.L1.Cardinality = protoreflect.Cardinality(v)
|
||||||
case genid.FieldDescriptorProto_Type_field_number:
|
case genid.FieldDescriptorProto_Type_field_number:
|
||||||
fd.L1.Kind = pref.Kind(v)
|
fd.L1.Kind = protoreflect.Kind(v)
|
||||||
case genid.FieldDescriptorProto_OneofIndex_field_number:
|
case genid.FieldDescriptorProto_OneofIndex_field_number:
|
||||||
// In Message.unmarshalFull, we allocate slices for both
|
// In Message.unmarshalFull, we allocate slices for both
|
||||||
// the field and oneof descriptors before unmarshaling either
|
// the field and oneof descriptors before unmarshaling either
|
||||||
|
|
@ -453,7 +454,7 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Des
|
||||||
case genid.FieldDescriptorProto_JsonName_field_number:
|
case genid.FieldDescriptorProto_JsonName_field_number:
|
||||||
fd.L1.StringName.InitJSON(sb.MakeString(v))
|
fd.L1.StringName.InitJSON(sb.MakeString(v))
|
||||||
case genid.FieldDescriptorProto_DefaultValue_field_number:
|
case genid.FieldDescriptorProto_DefaultValue_field_number:
|
||||||
fd.L1.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveMessages
|
fd.L1.Default.val = protoreflect.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveMessages
|
||||||
case genid.FieldDescriptorProto_TypeName_field_number:
|
case genid.FieldDescriptorProto_TypeName_field_number:
|
||||||
rawTypeName = v
|
rawTypeName = v
|
||||||
case genid.FieldDescriptorProto_Options_field_number:
|
case genid.FieldDescriptorProto_Options_field_number:
|
||||||
|
|
@ -465,12 +466,18 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Des
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if fd.L1.Kind == protoreflect.MessageKind && fd.L1.EditionFeatures.IsDelimitedEncoded {
|
||||||
|
fd.L1.Kind = protoreflect.GroupKind
|
||||||
|
}
|
||||||
|
if fd.L1.EditionFeatures.IsLegacyRequired {
|
||||||
|
fd.L1.Cardinality = protoreflect.Required
|
||||||
|
}
|
||||||
if rawTypeName != nil {
|
if rawTypeName != nil {
|
||||||
name := makeFullName(sb, rawTypeName)
|
name := makeFullName(sb, rawTypeName)
|
||||||
switch fd.L1.Kind {
|
switch fd.L1.Kind {
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
fd.L1.Enum = PlaceholderEnum(name)
|
fd.L1.Enum = PlaceholderEnum(name)
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
fd.L1.Message = PlaceholderMessage(name)
|
fd.L1.Message = PlaceholderMessage(name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -489,13 +496,18 @@ func (fd *Field) unmarshalOptions(b []byte) {
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case genid.FieldOptions_Packed_field_number:
|
case genid.FieldOptions_Packed_field_number:
|
||||||
fd.L1.HasPacked = true
|
fd.L1.EditionFeatures.IsPacked = protowire.DecodeBool(v)
|
||||||
fd.L1.IsPacked = protowire.DecodeBool(v)
|
|
||||||
case genid.FieldOptions_Weak_field_number:
|
case genid.FieldOptions_Weak_field_number:
|
||||||
fd.L1.IsWeak = protowire.DecodeBool(v)
|
fd.L1.IsWeak = protowire.DecodeBool(v)
|
||||||
case FieldOptions_EnforceUTF8:
|
case FieldOptions_EnforceUTF8:
|
||||||
fd.L1.HasEnforceUTF8 = true
|
fd.L1.EditionFeatures.IsUTF8Validated = protowire.DecodeBool(v)
|
||||||
fd.L1.EnforceUTF8 = protowire.DecodeBool(v)
|
}
|
||||||
|
case protowire.BytesType:
|
||||||
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FieldOptions_Features_field_number:
|
||||||
|
fd.L1.EditionFeatures = unmarshalFeatureSet(v, fd.L1.EditionFeatures)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
|
|
@ -504,7 +516,7 @@ func (fd *Field) unmarshalOptions(b []byte) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
od.L0.ParentFile = pf
|
od.L0.ParentFile = pf
|
||||||
od.L0.Parent = pd
|
od.L0.Parent = pd
|
||||||
od.L0.Index = i
|
od.L0.Index = i
|
||||||
|
|
@ -553,11 +565,10 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||||
case genid.FieldDescriptorProto_JsonName_field_number:
|
case genid.FieldDescriptorProto_JsonName_field_number:
|
||||||
xd.L2.StringName.InitJSON(sb.MakeString(v))
|
xd.L2.StringName.InitJSON(sb.MakeString(v))
|
||||||
case genid.FieldDescriptorProto_DefaultValue_field_number:
|
case genid.FieldDescriptorProto_DefaultValue_field_number:
|
||||||
xd.L2.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveExtensions
|
xd.L2.Default.val = protoreflect.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveExtensions
|
||||||
case genid.FieldDescriptorProto_TypeName_field_number:
|
case genid.FieldDescriptorProto_TypeName_field_number:
|
||||||
rawTypeName = v
|
rawTypeName = v
|
||||||
case genid.FieldDescriptorProto_Options_field_number:
|
case genid.FieldDescriptorProto_Options_field_number:
|
||||||
xd.unmarshalOptions(v)
|
|
||||||
rawOptions = appendOptions(rawOptions, v)
|
rawOptions = appendOptions(rawOptions, v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
@ -568,34 +579,15 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||||
if rawTypeName != nil {
|
if rawTypeName != nil {
|
||||||
name := makeFullName(sb, rawTypeName)
|
name := makeFullName(sb, rawTypeName)
|
||||||
switch xd.L1.Kind {
|
switch xd.L1.Kind {
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
xd.L2.Enum = PlaceholderEnum(name)
|
xd.L2.Enum = PlaceholderEnum(name)
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
xd.L2.Message = PlaceholderMessage(name)
|
xd.L2.Message = PlaceholderMessage(name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xd.L2.Options = xd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Field, rawOptions)
|
xd.L2.Options = xd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Field, rawOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (xd *Extension) unmarshalOptions(b []byte) {
|
|
||||||
for len(b) > 0 {
|
|
||||||
num, typ, n := protowire.ConsumeTag(b)
|
|
||||||
b = b[n:]
|
|
||||||
switch typ {
|
|
||||||
case protowire.VarintType:
|
|
||||||
v, m := protowire.ConsumeVarint(b)
|
|
||||||
b = b[m:]
|
|
||||||
switch num {
|
|
||||||
case genid.FieldOptions_Packed_field_number:
|
|
||||||
xd.L2.IsPacked = protowire.DecodeBool(v)
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
|
||||||
b = b[m:]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sd *Service) unmarshalFull(b []byte, sb *strs.Builder) {
|
func (sd *Service) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||||
var rawMethods [][]byte
|
var rawMethods [][]byte
|
||||||
var rawOptions []byte
|
var rawOptions []byte
|
||||||
|
|
@ -627,7 +619,7 @@ func (sd *Service) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||||
sd.L2.Options = sd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Service, rawOptions)
|
sd.L2.Options = sd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Service, rawOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (md *Method) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (md *Method) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
md.L0.ParentFile = pf
|
md.L0.ParentFile = pf
|
||||||
md.L0.Parent = pd
|
md.L0.Parent = pd
|
||||||
md.L0.Index = i
|
md.L0.Index = i
|
||||||
|
|
@ -680,18 +672,18 @@ func appendOptions(dst, src []byte) []byte {
|
||||||
//
|
//
|
||||||
// The type of message to unmarshal to is passed as a pointer since the
|
// The type of message to unmarshal to is passed as a pointer since the
|
||||||
// vars in descopts may not yet be populated at the time this function is called.
|
// vars in descopts may not yet be populated at the time this function is called.
|
||||||
func (db *Builder) optionsUnmarshaler(p *pref.ProtoMessage, b []byte) func() pref.ProtoMessage {
|
func (db *Builder) optionsUnmarshaler(p *protoreflect.ProtoMessage, b []byte) func() protoreflect.ProtoMessage {
|
||||||
if b == nil {
|
if b == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var opts pref.ProtoMessage
|
var opts protoreflect.ProtoMessage
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
return func() pref.ProtoMessage {
|
return func() protoreflect.ProtoMessage {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
if *p == nil {
|
if *p == nil {
|
||||||
panic("Descriptor.Options called without importing the descriptor package")
|
panic("Descriptor.Options called without importing the descriptor package")
|
||||||
}
|
}
|
||||||
opts = reflect.New(reflect.TypeOf(*p).Elem()).Interface().(pref.ProtoMessage)
|
opts = reflect.New(reflect.TypeOf(*p).Elem()).Interface().(protoreflect.ProtoMessage)
|
||||||
if err := (proto.UnmarshalOptions{
|
if err := (proto.UnmarshalOptions{
|
||||||
AllowPartial: true,
|
AllowPartial: true,
|
||||||
Resolver: db.TypeResolver,
|
Resolver: db.TypeResolver,
|
||||||
|
|
|
||||||
167
vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go
generated
vendored
167
vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go
generated
vendored
|
|
@ -17,31 +17,30 @@ import (
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type FileImports []pref.FileImport
|
type FileImports []protoreflect.FileImport
|
||||||
|
|
||||||
func (p *FileImports) Len() int { return len(*p) }
|
func (p *FileImports) Len() int { return len(*p) }
|
||||||
func (p *FileImports) Get(i int) pref.FileImport { return (*p)[i] }
|
func (p *FileImports) Get(i int) protoreflect.FileImport { return (*p)[i] }
|
||||||
func (p *FileImports) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
func (p *FileImports) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
||||||
func (p *FileImports) ProtoInternal(pragma.DoNotImplement) {}
|
func (p *FileImports) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
|
|
||||||
type Names struct {
|
type Names struct {
|
||||||
List []pref.Name
|
List []protoreflect.Name
|
||||||
once sync.Once
|
once sync.Once
|
||||||
has map[pref.Name]int // protected by once
|
has map[protoreflect.Name]int // protected by once
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Names) Len() int { return len(p.List) }
|
func (p *Names) Len() int { return len(p.List) }
|
||||||
func (p *Names) Get(i int) pref.Name { return p.List[i] }
|
func (p *Names) Get(i int) protoreflect.Name { return p.List[i] }
|
||||||
func (p *Names) Has(s pref.Name) bool { return p.lazyInit().has[s] > 0 }
|
func (p *Names) Has(s protoreflect.Name) bool { return p.lazyInit().has[s] > 0 }
|
||||||
func (p *Names) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
func (p *Names) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
||||||
func (p *Names) ProtoInternal(pragma.DoNotImplement) {}
|
func (p *Names) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
func (p *Names) lazyInit() *Names {
|
func (p *Names) lazyInit() *Names {
|
||||||
p.once.Do(func() {
|
p.once.Do(func() {
|
||||||
if len(p.List) > 0 {
|
if len(p.List) > 0 {
|
||||||
p.has = make(map[pref.Name]int, len(p.List))
|
p.has = make(map[protoreflect.Name]int, len(p.List))
|
||||||
for _, s := range p.List {
|
for _, s := range p.List {
|
||||||
p.has[s] = p.has[s] + 1
|
p.has[s] = p.has[s] + 1
|
||||||
}
|
}
|
||||||
|
|
@ -67,14 +66,14 @@ func (p *Names) CheckValid() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
type EnumRanges struct {
|
type EnumRanges struct {
|
||||||
List [][2]pref.EnumNumber // start inclusive; end inclusive
|
List [][2]protoreflect.EnumNumber // start inclusive; end inclusive
|
||||||
once sync.Once
|
once sync.Once
|
||||||
sorted [][2]pref.EnumNumber // protected by once
|
sorted [][2]protoreflect.EnumNumber // protected by once
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *EnumRanges) Len() int { return len(p.List) }
|
func (p *EnumRanges) Len() int { return len(p.List) }
|
||||||
func (p *EnumRanges) Get(i int) [2]pref.EnumNumber { return p.List[i] }
|
func (p *EnumRanges) Get(i int) [2]protoreflect.EnumNumber { return p.List[i] }
|
||||||
func (p *EnumRanges) Has(n pref.EnumNumber) bool {
|
func (p *EnumRanges) Has(n protoreflect.EnumNumber) bool {
|
||||||
for ls := p.lazyInit().sorted; len(ls) > 0; {
|
for ls := p.lazyInit().sorted; len(ls) > 0; {
|
||||||
i := len(ls) / 2
|
i := len(ls) / 2
|
||||||
switch r := enumRange(ls[i]); {
|
switch r := enumRange(ls[i]); {
|
||||||
|
|
@ -129,14 +128,14 @@ func (r enumRange) String() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
type FieldRanges struct {
|
type FieldRanges struct {
|
||||||
List [][2]pref.FieldNumber // start inclusive; end exclusive
|
List [][2]protoreflect.FieldNumber // start inclusive; end exclusive
|
||||||
once sync.Once
|
once sync.Once
|
||||||
sorted [][2]pref.FieldNumber // protected by once
|
sorted [][2]protoreflect.FieldNumber // protected by once
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *FieldRanges) Len() int { return len(p.List) }
|
func (p *FieldRanges) Len() int { return len(p.List) }
|
||||||
func (p *FieldRanges) Get(i int) [2]pref.FieldNumber { return p.List[i] }
|
func (p *FieldRanges) Get(i int) [2]protoreflect.FieldNumber { return p.List[i] }
|
||||||
func (p *FieldRanges) Has(n pref.FieldNumber) bool {
|
func (p *FieldRanges) Has(n protoreflect.FieldNumber) bool {
|
||||||
for ls := p.lazyInit().sorted; len(ls) > 0; {
|
for ls := p.lazyInit().sorted; len(ls) > 0; {
|
||||||
i := len(ls) / 2
|
i := len(ls) / 2
|
||||||
switch r := fieldRange(ls[i]); {
|
switch r := fieldRange(ls[i]); {
|
||||||
|
|
@ -221,17 +220,17 @@ func (r fieldRange) String() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
type FieldNumbers struct {
|
type FieldNumbers struct {
|
||||||
List []pref.FieldNumber
|
List []protoreflect.FieldNumber
|
||||||
once sync.Once
|
once sync.Once
|
||||||
has map[pref.FieldNumber]struct{} // protected by once
|
has map[protoreflect.FieldNumber]struct{} // protected by once
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *FieldNumbers) Len() int { return len(p.List) }
|
func (p *FieldNumbers) Len() int { return len(p.List) }
|
||||||
func (p *FieldNumbers) Get(i int) pref.FieldNumber { return p.List[i] }
|
func (p *FieldNumbers) Get(i int) protoreflect.FieldNumber { return p.List[i] }
|
||||||
func (p *FieldNumbers) Has(n pref.FieldNumber) bool {
|
func (p *FieldNumbers) Has(n protoreflect.FieldNumber) bool {
|
||||||
p.once.Do(func() {
|
p.once.Do(func() {
|
||||||
if len(p.List) > 0 {
|
if len(p.List) > 0 {
|
||||||
p.has = make(map[pref.FieldNumber]struct{}, len(p.List))
|
p.has = make(map[protoreflect.FieldNumber]struct{}, len(p.List))
|
||||||
for _, n := range p.List {
|
for _, n := range p.List {
|
||||||
p.has[n] = struct{}{}
|
p.has[n] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
@ -244,30 +243,38 @@ func (p *FieldNumbers) Format(s fmt.State, r rune) { descfmt.FormatList
|
||||||
func (p *FieldNumbers) ProtoInternal(pragma.DoNotImplement) {}
|
func (p *FieldNumbers) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
|
|
||||||
type OneofFields struct {
|
type OneofFields struct {
|
||||||
List []pref.FieldDescriptor
|
List []protoreflect.FieldDescriptor
|
||||||
once sync.Once
|
once sync.Once
|
||||||
byName map[pref.Name]pref.FieldDescriptor // protected by once
|
byName map[protoreflect.Name]protoreflect.FieldDescriptor // protected by once
|
||||||
byJSON map[string]pref.FieldDescriptor // protected by once
|
byJSON map[string]protoreflect.FieldDescriptor // protected by once
|
||||||
byText map[string]pref.FieldDescriptor // protected by once
|
byText map[string]protoreflect.FieldDescriptor // protected by once
|
||||||
byNum map[pref.FieldNumber]pref.FieldDescriptor // protected by once
|
byNum map[protoreflect.FieldNumber]protoreflect.FieldDescriptor // protected by once
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *OneofFields) Len() int { return len(p.List) }
|
func (p *OneofFields) Len() int { return len(p.List) }
|
||||||
func (p *OneofFields) Get(i int) pref.FieldDescriptor { return p.List[i] }
|
func (p *OneofFields) Get(i int) protoreflect.FieldDescriptor { return p.List[i] }
|
||||||
func (p *OneofFields) ByName(s pref.Name) pref.FieldDescriptor { return p.lazyInit().byName[s] }
|
func (p *OneofFields) ByName(s protoreflect.Name) protoreflect.FieldDescriptor {
|
||||||
func (p *OneofFields) ByJSONName(s string) pref.FieldDescriptor { return p.lazyInit().byJSON[s] }
|
return p.lazyInit().byName[s]
|
||||||
func (p *OneofFields) ByTextName(s string) pref.FieldDescriptor { return p.lazyInit().byText[s] }
|
}
|
||||||
func (p *OneofFields) ByNumber(n pref.FieldNumber) pref.FieldDescriptor { return p.lazyInit().byNum[n] }
|
func (p *OneofFields) ByJSONName(s string) protoreflect.FieldDescriptor {
|
||||||
func (p *OneofFields) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
return p.lazyInit().byJSON[s]
|
||||||
func (p *OneofFields) ProtoInternal(pragma.DoNotImplement) {}
|
}
|
||||||
|
func (p *OneofFields) ByTextName(s string) protoreflect.FieldDescriptor {
|
||||||
|
return p.lazyInit().byText[s]
|
||||||
|
}
|
||||||
|
func (p *OneofFields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescriptor {
|
||||||
|
return p.lazyInit().byNum[n]
|
||||||
|
}
|
||||||
|
func (p *OneofFields) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
||||||
|
func (p *OneofFields) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
|
|
||||||
func (p *OneofFields) lazyInit() *OneofFields {
|
func (p *OneofFields) lazyInit() *OneofFields {
|
||||||
p.once.Do(func() {
|
p.once.Do(func() {
|
||||||
if len(p.List) > 0 {
|
if len(p.List) > 0 {
|
||||||
p.byName = make(map[pref.Name]pref.FieldDescriptor, len(p.List))
|
p.byName = make(map[protoreflect.Name]protoreflect.FieldDescriptor, len(p.List))
|
||||||
p.byJSON = make(map[string]pref.FieldDescriptor, len(p.List))
|
p.byJSON = make(map[string]protoreflect.FieldDescriptor, len(p.List))
|
||||||
p.byText = make(map[string]pref.FieldDescriptor, len(p.List))
|
p.byText = make(map[string]protoreflect.FieldDescriptor, len(p.List))
|
||||||
p.byNum = make(map[pref.FieldNumber]pref.FieldDescriptor, len(p.List))
|
p.byNum = make(map[protoreflect.FieldNumber]protoreflect.FieldDescriptor, len(p.List))
|
||||||
for _, f := range p.List {
|
for _, f := range p.List {
|
||||||
// Field names and numbers are guaranteed to be unique.
|
// Field names and numbers are guaranteed to be unique.
|
||||||
p.byName[f.Name()] = f
|
p.byName[f.Name()] = f
|
||||||
|
|
@ -284,123 +291,123 @@ type SourceLocations struct {
|
||||||
// List is a list of SourceLocations.
|
// List is a list of SourceLocations.
|
||||||
// The SourceLocation.Next field does not need to be populated
|
// The SourceLocation.Next field does not need to be populated
|
||||||
// as it will be lazily populated upon first need.
|
// as it will be lazily populated upon first need.
|
||||||
List []pref.SourceLocation
|
List []protoreflect.SourceLocation
|
||||||
|
|
||||||
// File is the parent file descriptor that these locations are relative to.
|
// File is the parent file descriptor that these locations are relative to.
|
||||||
// If non-nil, ByDescriptor verifies that the provided descriptor
|
// If non-nil, ByDescriptor verifies that the provided descriptor
|
||||||
// is a child of this file descriptor.
|
// is a child of this file descriptor.
|
||||||
File pref.FileDescriptor
|
File protoreflect.FileDescriptor
|
||||||
|
|
||||||
once sync.Once
|
once sync.Once
|
||||||
byPath map[pathKey]int
|
byPath map[pathKey]int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *SourceLocations) Len() int { return len(p.List) }
|
func (p *SourceLocations) Len() int { return len(p.List) }
|
||||||
func (p *SourceLocations) Get(i int) pref.SourceLocation { return p.lazyInit().List[i] }
|
func (p *SourceLocations) Get(i int) protoreflect.SourceLocation { return p.lazyInit().List[i] }
|
||||||
func (p *SourceLocations) byKey(k pathKey) pref.SourceLocation {
|
func (p *SourceLocations) byKey(k pathKey) protoreflect.SourceLocation {
|
||||||
if i, ok := p.lazyInit().byPath[k]; ok {
|
if i, ok := p.lazyInit().byPath[k]; ok {
|
||||||
return p.List[i]
|
return p.List[i]
|
||||||
}
|
}
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
func (p *SourceLocations) ByPath(path pref.SourcePath) pref.SourceLocation {
|
func (p *SourceLocations) ByPath(path protoreflect.SourcePath) protoreflect.SourceLocation {
|
||||||
return p.byKey(newPathKey(path))
|
return p.byKey(newPathKey(path))
|
||||||
}
|
}
|
||||||
func (p *SourceLocations) ByDescriptor(desc pref.Descriptor) pref.SourceLocation {
|
func (p *SourceLocations) ByDescriptor(desc protoreflect.Descriptor) protoreflect.SourceLocation {
|
||||||
if p.File != nil && desc != nil && p.File != desc.ParentFile() {
|
if p.File != nil && desc != nil && p.File != desc.ParentFile() {
|
||||||
return pref.SourceLocation{} // mismatching parent files
|
return protoreflect.SourceLocation{} // mismatching parent files
|
||||||
}
|
}
|
||||||
var pathArr [16]int32
|
var pathArr [16]int32
|
||||||
path := pathArr[:0]
|
path := pathArr[:0]
|
||||||
for {
|
for {
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.FileDescriptor:
|
case protoreflect.FileDescriptor:
|
||||||
// Reverse the path since it was constructed in reverse.
|
// Reverse the path since it was constructed in reverse.
|
||||||
for i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {
|
for i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {
|
||||||
path[i], path[j] = path[j], path[i]
|
path[i], path[j] = path[j], path[i]
|
||||||
}
|
}
|
||||||
return p.byKey(newPathKey(path))
|
return p.byKey(newPathKey(path))
|
||||||
case pref.MessageDescriptor:
|
case protoreflect.MessageDescriptor:
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.FileDescriptor:
|
case protoreflect.FileDescriptor:
|
||||||
path = append(path, int32(genid.FileDescriptorProto_MessageType_field_number))
|
path = append(path, int32(genid.FileDescriptorProto_MessageType_field_number))
|
||||||
case pref.MessageDescriptor:
|
case protoreflect.MessageDescriptor:
|
||||||
path = append(path, int32(genid.DescriptorProto_NestedType_field_number))
|
path = append(path, int32(genid.DescriptorProto_NestedType_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
case pref.FieldDescriptor:
|
case protoreflect.FieldDescriptor:
|
||||||
isExtension := desc.(pref.FieldDescriptor).IsExtension()
|
isExtension := desc.(protoreflect.FieldDescriptor).IsExtension()
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
if isExtension {
|
if isExtension {
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.FileDescriptor:
|
case protoreflect.FileDescriptor:
|
||||||
path = append(path, int32(genid.FileDescriptorProto_Extension_field_number))
|
path = append(path, int32(genid.FileDescriptorProto_Extension_field_number))
|
||||||
case pref.MessageDescriptor:
|
case protoreflect.MessageDescriptor:
|
||||||
path = append(path, int32(genid.DescriptorProto_Extension_field_number))
|
path = append(path, int32(genid.DescriptorProto_Extension_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.MessageDescriptor:
|
case protoreflect.MessageDescriptor:
|
||||||
path = append(path, int32(genid.DescriptorProto_Field_field_number))
|
path = append(path, int32(genid.DescriptorProto_Field_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.OneofDescriptor:
|
case protoreflect.OneofDescriptor:
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.MessageDescriptor:
|
case protoreflect.MessageDescriptor:
|
||||||
path = append(path, int32(genid.DescriptorProto_OneofDecl_field_number))
|
path = append(path, int32(genid.DescriptorProto_OneofDecl_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
case pref.EnumDescriptor:
|
case protoreflect.EnumDescriptor:
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.FileDescriptor:
|
case protoreflect.FileDescriptor:
|
||||||
path = append(path, int32(genid.FileDescriptorProto_EnumType_field_number))
|
path = append(path, int32(genid.FileDescriptorProto_EnumType_field_number))
|
||||||
case pref.MessageDescriptor:
|
case protoreflect.MessageDescriptor:
|
||||||
path = append(path, int32(genid.DescriptorProto_EnumType_field_number))
|
path = append(path, int32(genid.DescriptorProto_EnumType_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
case pref.EnumValueDescriptor:
|
case protoreflect.EnumValueDescriptor:
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.EnumDescriptor:
|
case protoreflect.EnumDescriptor:
|
||||||
path = append(path, int32(genid.EnumDescriptorProto_Value_field_number))
|
path = append(path, int32(genid.EnumDescriptorProto_Value_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
case pref.ServiceDescriptor:
|
case protoreflect.ServiceDescriptor:
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.FileDescriptor:
|
case protoreflect.FileDescriptor:
|
||||||
path = append(path, int32(genid.FileDescriptorProto_Service_field_number))
|
path = append(path, int32(genid.FileDescriptorProto_Service_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
case pref.MethodDescriptor:
|
case protoreflect.MethodDescriptor:
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.ServiceDescriptor:
|
case protoreflect.ServiceDescriptor:
|
||||||
path = append(path, int32(genid.ServiceDescriptorProto_Method_field_number))
|
path = append(path, int32(genid.ServiceDescriptorProto_Method_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -435,7 +442,7 @@ type pathKey struct {
|
||||||
str string // used if the path does not fit in arr
|
str string // used if the path does not fit in arr
|
||||||
}
|
}
|
||||||
|
|
||||||
func newPathKey(p pref.SourcePath) (k pathKey) {
|
func newPathKey(p protoreflect.SourcePath) (k pathKey) {
|
||||||
if len(p) < len(k.arr) {
|
if len(p) < len(k.arr) {
|
||||||
for i, ps := range p {
|
for i, ps := range p {
|
||||||
if ps < 0 || math.MaxUint8 <= ps {
|
if ps < 0 || math.MaxUint8 <= ps {
|
||||||
|
|
|
||||||
11
vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go
generated
vendored
11
vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go
generated
vendored
|
|
@ -8,6 +8,7 @@ package filedesc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"google.golang.org/protobuf/internal/descfmt"
|
"google.golang.org/protobuf/internal/descfmt"
|
||||||
|
|
@ -198,6 +199,16 @@ func (p *Fields) lazyInit() *Fields {
|
||||||
if _, ok := p.byText[d.TextName()]; !ok {
|
if _, ok := p.byText[d.TextName()]; !ok {
|
||||||
p.byText[d.TextName()] = d
|
p.byText[d.TextName()] = d
|
||||||
}
|
}
|
||||||
|
if isGroupLike(d) {
|
||||||
|
lowerJSONName := strings.ToLower(d.JSONName())
|
||||||
|
if _, ok := p.byJSON[lowerJSONName]; !ok {
|
||||||
|
p.byJSON[lowerJSONName] = d
|
||||||
|
}
|
||||||
|
lowerTextName := strings.ToLower(d.TextName())
|
||||||
|
if _, ok := p.byText[lowerTextName]; !ok {
|
||||||
|
p.byText[lowerTextName] = d
|
||||||
|
}
|
||||||
|
}
|
||||||
if _, ok := p.byNum[d.Number()]; !ok {
|
if _, ok := p.byNum[d.Number()]; !ok {
|
||||||
p.byNum[d.Number()] = d
|
p.byNum[d.Number()] = d
|
||||||
}
|
}
|
||||||
|
|
|
||||||
156
vendor/google.golang.org/protobuf/internal/filedesc/editions.go
generated
vendored
Normal file
156
vendor/google.golang.org/protobuf/internal/filedesc/editions.go
generated
vendored
Normal file
|
|
@ -0,0 +1,156 @@
|
||||||
|
// Copyright 2024 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 filedesc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
|
"google.golang.org/protobuf/internal/editiondefaults"
|
||||||
|
"google.golang.org/protobuf/internal/genid"
|
||||||
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
var defaultsCache = make(map[Edition]EditionFeatures)
|
||||||
|
var defaultsKeys = []Edition{}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
unmarshalEditionDefaults(editiondefaults.Defaults)
|
||||||
|
SurrogateProto2.L1.EditionFeatures = getFeaturesFor(EditionProto2)
|
||||||
|
SurrogateProto3.L1.EditionFeatures = getFeaturesFor(EditionProto3)
|
||||||
|
SurrogateEdition2023.L1.EditionFeatures = getFeaturesFor(Edition2023)
|
||||||
|
}
|
||||||
|
|
||||||
|
func unmarshalGoFeature(b []byte, parent EditionFeatures) EditionFeatures {
|
||||||
|
for len(b) > 0 {
|
||||||
|
num, _, n := protowire.ConsumeTag(b)
|
||||||
|
b = b[n:]
|
||||||
|
switch num {
|
||||||
|
case genid.GoFeatures_LegacyUnmarshalJsonEnum_field_number:
|
||||||
|
v, m := protowire.ConsumeVarint(b)
|
||||||
|
b = b[m:]
|
||||||
|
parent.GenerateLegacyUnmarshalJSON = protowire.DecodeBool(v)
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unkown field number %d while unmarshalling GoFeatures", num))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return parent
|
||||||
|
}
|
||||||
|
|
||||||
|
func unmarshalFeatureSet(b []byte, parent EditionFeatures) EditionFeatures {
|
||||||
|
for len(b) > 0 {
|
||||||
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
|
b = b[n:]
|
||||||
|
switch typ {
|
||||||
|
case protowire.VarintType:
|
||||||
|
v, m := protowire.ConsumeVarint(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FeatureSet_FieldPresence_field_number:
|
||||||
|
parent.IsFieldPresence = v == genid.FeatureSet_EXPLICIT_enum_value || v == genid.FeatureSet_LEGACY_REQUIRED_enum_value
|
||||||
|
parent.IsLegacyRequired = v == genid.FeatureSet_LEGACY_REQUIRED_enum_value
|
||||||
|
case genid.FeatureSet_EnumType_field_number:
|
||||||
|
parent.IsOpenEnum = v == genid.FeatureSet_OPEN_enum_value
|
||||||
|
case genid.FeatureSet_RepeatedFieldEncoding_field_number:
|
||||||
|
parent.IsPacked = v == genid.FeatureSet_PACKED_enum_value
|
||||||
|
case genid.FeatureSet_Utf8Validation_field_number:
|
||||||
|
parent.IsUTF8Validated = v == genid.FeatureSet_VERIFY_enum_value
|
||||||
|
case genid.FeatureSet_MessageEncoding_field_number:
|
||||||
|
parent.IsDelimitedEncoded = v == genid.FeatureSet_DELIMITED_enum_value
|
||||||
|
case genid.FeatureSet_JsonFormat_field_number:
|
||||||
|
parent.IsJSONCompliant = v == genid.FeatureSet_ALLOW_enum_value
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unkown field number %d while unmarshalling FeatureSet", num))
|
||||||
|
}
|
||||||
|
case protowire.BytesType:
|
||||||
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.GoFeatures_LegacyUnmarshalJsonEnum_field_number:
|
||||||
|
parent = unmarshalGoFeature(v, parent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent
|
||||||
|
}
|
||||||
|
|
||||||
|
func featuresFromParentDesc(parentDesc protoreflect.Descriptor) EditionFeatures {
|
||||||
|
var parentFS EditionFeatures
|
||||||
|
switch p := parentDesc.(type) {
|
||||||
|
case *File:
|
||||||
|
parentFS = p.L1.EditionFeatures
|
||||||
|
case *Message:
|
||||||
|
parentFS = p.L1.EditionFeatures
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unknown parent type %T", parentDesc))
|
||||||
|
}
|
||||||
|
return parentFS
|
||||||
|
}
|
||||||
|
|
||||||
|
func unmarshalEditionDefault(b []byte) {
|
||||||
|
var ed Edition
|
||||||
|
var fs EditionFeatures
|
||||||
|
for len(b) > 0 {
|
||||||
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
|
b = b[n:]
|
||||||
|
switch typ {
|
||||||
|
case protowire.VarintType:
|
||||||
|
v, m := protowire.ConsumeVarint(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_number:
|
||||||
|
ed = Edition(v)
|
||||||
|
}
|
||||||
|
case protowire.BytesType:
|
||||||
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FeatureSetDefaults_FeatureSetEditionDefault_FixedFeatures_field_number:
|
||||||
|
fs = unmarshalFeatureSet(v, fs)
|
||||||
|
case genid.FeatureSetDefaults_FeatureSetEditionDefault_OverridableFeatures_field_number:
|
||||||
|
fs = unmarshalFeatureSet(v, fs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defaultsCache[ed] = fs
|
||||||
|
defaultsKeys = append(defaultsKeys, ed)
|
||||||
|
}
|
||||||
|
|
||||||
|
func unmarshalEditionDefaults(b []byte) {
|
||||||
|
for len(b) > 0 {
|
||||||
|
num, _, n := protowire.ConsumeTag(b)
|
||||||
|
b = b[n:]
|
||||||
|
switch num {
|
||||||
|
case genid.FeatureSetDefaults_Defaults_field_number:
|
||||||
|
def, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
unmarshalEditionDefault(def)
|
||||||
|
case genid.FeatureSetDefaults_MinimumEdition_field_number,
|
||||||
|
genid.FeatureSetDefaults_MaximumEdition_field_number:
|
||||||
|
// We don't care about the minimum and maximum editions. If the
|
||||||
|
// edition we are looking for later on is not in the cache we know
|
||||||
|
// it is outside of the range between minimum and maximum edition.
|
||||||
|
_, m := protowire.ConsumeVarint(b)
|
||||||
|
b = b[m:]
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unkown field number %d while unmarshalling EditionDefault", num))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func getFeaturesFor(ed Edition) EditionFeatures {
|
||||||
|
match := EditionUnknown
|
||||||
|
for _, key := range defaultsKeys {
|
||||||
|
if key > ed {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
match = key
|
||||||
|
}
|
||||||
|
if match == EditionUnknown {
|
||||||
|
panic(fmt.Sprintf("unsupported edition: %v", ed))
|
||||||
|
}
|
||||||
|
return defaultsCache[match]
|
||||||
|
}
|
||||||
137
vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go
generated
vendored
137
vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go
generated
vendored
|
|
@ -7,7 +7,7 @@ package filedesc
|
||||||
import (
|
import (
|
||||||
"google.golang.org/protobuf/internal/descopts"
|
"google.golang.org/protobuf/internal/descopts"
|
||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -30,78 +30,81 @@ var (
|
||||||
// PlaceholderFile is a placeholder, representing only the file path.
|
// PlaceholderFile is a placeholder, representing only the file path.
|
||||||
type PlaceholderFile string
|
type PlaceholderFile string
|
||||||
|
|
||||||
func (f PlaceholderFile) ParentFile() pref.FileDescriptor { return f }
|
func (f PlaceholderFile) ParentFile() protoreflect.FileDescriptor { return f }
|
||||||
func (f PlaceholderFile) Parent() pref.Descriptor { return nil }
|
func (f PlaceholderFile) Parent() protoreflect.Descriptor { return nil }
|
||||||
func (f PlaceholderFile) Index() int { return 0 }
|
func (f PlaceholderFile) Index() int { return 0 }
|
||||||
func (f PlaceholderFile) Syntax() pref.Syntax { return 0 }
|
func (f PlaceholderFile) Syntax() protoreflect.Syntax { return 0 }
|
||||||
func (f PlaceholderFile) Name() pref.Name { return "" }
|
func (f PlaceholderFile) Name() protoreflect.Name { return "" }
|
||||||
func (f PlaceholderFile) FullName() pref.FullName { return "" }
|
func (f PlaceholderFile) FullName() protoreflect.FullName { return "" }
|
||||||
func (f PlaceholderFile) IsPlaceholder() bool { return true }
|
func (f PlaceholderFile) IsPlaceholder() bool { return true }
|
||||||
func (f PlaceholderFile) Options() pref.ProtoMessage { return descopts.File }
|
func (f PlaceholderFile) Options() protoreflect.ProtoMessage { return descopts.File }
|
||||||
func (f PlaceholderFile) Path() string { return string(f) }
|
func (f PlaceholderFile) Path() string { return string(f) }
|
||||||
func (f PlaceholderFile) Package() pref.FullName { return "" }
|
func (f PlaceholderFile) Package() protoreflect.FullName { return "" }
|
||||||
func (f PlaceholderFile) Imports() pref.FileImports { return emptyFiles }
|
func (f PlaceholderFile) Imports() protoreflect.FileImports { return emptyFiles }
|
||||||
func (f PlaceholderFile) Messages() pref.MessageDescriptors { return emptyMessages }
|
func (f PlaceholderFile) Messages() protoreflect.MessageDescriptors { return emptyMessages }
|
||||||
func (f PlaceholderFile) Enums() pref.EnumDescriptors { return emptyEnums }
|
func (f PlaceholderFile) Enums() protoreflect.EnumDescriptors { return emptyEnums }
|
||||||
func (f PlaceholderFile) Extensions() pref.ExtensionDescriptors { return emptyExtensions }
|
func (f PlaceholderFile) Extensions() protoreflect.ExtensionDescriptors { return emptyExtensions }
|
||||||
func (f PlaceholderFile) Services() pref.ServiceDescriptors { return emptyServices }
|
func (f PlaceholderFile) Services() protoreflect.ServiceDescriptors { return emptyServices }
|
||||||
func (f PlaceholderFile) SourceLocations() pref.SourceLocations { return emptySourceLocations }
|
func (f PlaceholderFile) SourceLocations() protoreflect.SourceLocations { return emptySourceLocations }
|
||||||
func (f PlaceholderFile) ProtoType(pref.FileDescriptor) { return }
|
func (f PlaceholderFile) ProtoType(protoreflect.FileDescriptor) { return }
|
||||||
func (f PlaceholderFile) ProtoInternal(pragma.DoNotImplement) { return }
|
func (f PlaceholderFile) ProtoInternal(pragma.DoNotImplement) { return }
|
||||||
|
|
||||||
// PlaceholderEnum is a placeholder, representing only the full name.
|
// PlaceholderEnum is a placeholder, representing only the full name.
|
||||||
type PlaceholderEnum pref.FullName
|
type PlaceholderEnum protoreflect.FullName
|
||||||
|
|
||||||
func (e PlaceholderEnum) ParentFile() pref.FileDescriptor { return nil }
|
func (e PlaceholderEnum) ParentFile() protoreflect.FileDescriptor { return nil }
|
||||||
func (e PlaceholderEnum) Parent() pref.Descriptor { return nil }
|
func (e PlaceholderEnum) Parent() protoreflect.Descriptor { return nil }
|
||||||
func (e PlaceholderEnum) Index() int { return 0 }
|
func (e PlaceholderEnum) Index() int { return 0 }
|
||||||
func (e PlaceholderEnum) Syntax() pref.Syntax { return 0 }
|
func (e PlaceholderEnum) Syntax() protoreflect.Syntax { return 0 }
|
||||||
func (e PlaceholderEnum) Name() pref.Name { return pref.FullName(e).Name() }
|
func (e PlaceholderEnum) Name() protoreflect.Name { return protoreflect.FullName(e).Name() }
|
||||||
func (e PlaceholderEnum) FullName() pref.FullName { return pref.FullName(e) }
|
func (e PlaceholderEnum) FullName() protoreflect.FullName { return protoreflect.FullName(e) }
|
||||||
func (e PlaceholderEnum) IsPlaceholder() bool { return true }
|
func (e PlaceholderEnum) IsPlaceholder() bool { return true }
|
||||||
func (e PlaceholderEnum) Options() pref.ProtoMessage { return descopts.Enum }
|
func (e PlaceholderEnum) Options() protoreflect.ProtoMessage { return descopts.Enum }
|
||||||
func (e PlaceholderEnum) Values() pref.EnumValueDescriptors { return emptyEnumValues }
|
func (e PlaceholderEnum) Values() protoreflect.EnumValueDescriptors { return emptyEnumValues }
|
||||||
func (e PlaceholderEnum) ReservedNames() pref.Names { return emptyNames }
|
func (e PlaceholderEnum) ReservedNames() protoreflect.Names { return emptyNames }
|
||||||
func (e PlaceholderEnum) ReservedRanges() pref.EnumRanges { return emptyEnumRanges }
|
func (e PlaceholderEnum) ReservedRanges() protoreflect.EnumRanges { return emptyEnumRanges }
|
||||||
func (e PlaceholderEnum) ProtoType(pref.EnumDescriptor) { return }
|
func (e PlaceholderEnum) IsClosed() bool { return false }
|
||||||
func (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement) { return }
|
func (e PlaceholderEnum) ProtoType(protoreflect.EnumDescriptor) { return }
|
||||||
|
func (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement) { return }
|
||||||
|
|
||||||
// PlaceholderEnumValue is a placeholder, representing only the full name.
|
// PlaceholderEnumValue is a placeholder, representing only the full name.
|
||||||
type PlaceholderEnumValue pref.FullName
|
type PlaceholderEnumValue protoreflect.FullName
|
||||||
|
|
||||||
func (e PlaceholderEnumValue) ParentFile() pref.FileDescriptor { return nil }
|
func (e PlaceholderEnumValue) ParentFile() protoreflect.FileDescriptor { return nil }
|
||||||
func (e PlaceholderEnumValue) Parent() pref.Descriptor { return nil }
|
func (e PlaceholderEnumValue) Parent() protoreflect.Descriptor { return nil }
|
||||||
func (e PlaceholderEnumValue) Index() int { return 0 }
|
func (e PlaceholderEnumValue) Index() int { return 0 }
|
||||||
func (e PlaceholderEnumValue) Syntax() pref.Syntax { return 0 }
|
func (e PlaceholderEnumValue) Syntax() protoreflect.Syntax { return 0 }
|
||||||
func (e PlaceholderEnumValue) Name() pref.Name { return pref.FullName(e).Name() }
|
func (e PlaceholderEnumValue) Name() protoreflect.Name { return protoreflect.FullName(e).Name() }
|
||||||
func (e PlaceholderEnumValue) FullName() pref.FullName { return pref.FullName(e) }
|
func (e PlaceholderEnumValue) FullName() protoreflect.FullName { return protoreflect.FullName(e) }
|
||||||
func (e PlaceholderEnumValue) IsPlaceholder() bool { return true }
|
func (e PlaceholderEnumValue) IsPlaceholder() bool { return true }
|
||||||
func (e PlaceholderEnumValue) Options() pref.ProtoMessage { return descopts.EnumValue }
|
func (e PlaceholderEnumValue) Options() protoreflect.ProtoMessage { return descopts.EnumValue }
|
||||||
func (e PlaceholderEnumValue) Number() pref.EnumNumber { return 0 }
|
func (e PlaceholderEnumValue) Number() protoreflect.EnumNumber { return 0 }
|
||||||
func (e PlaceholderEnumValue) ProtoType(pref.EnumValueDescriptor) { return }
|
func (e PlaceholderEnumValue) ProtoType(protoreflect.EnumValueDescriptor) { return }
|
||||||
func (e PlaceholderEnumValue) ProtoInternal(pragma.DoNotImplement) { return }
|
func (e PlaceholderEnumValue) ProtoInternal(pragma.DoNotImplement) { return }
|
||||||
|
|
||||||
// PlaceholderMessage is a placeholder, representing only the full name.
|
// PlaceholderMessage is a placeholder, representing only the full name.
|
||||||
type PlaceholderMessage pref.FullName
|
type PlaceholderMessage protoreflect.FullName
|
||||||
|
|
||||||
func (m PlaceholderMessage) ParentFile() pref.FileDescriptor { return nil }
|
func (m PlaceholderMessage) ParentFile() protoreflect.FileDescriptor { return nil }
|
||||||
func (m PlaceholderMessage) Parent() pref.Descriptor { return nil }
|
func (m PlaceholderMessage) Parent() protoreflect.Descriptor { return nil }
|
||||||
func (m PlaceholderMessage) Index() int { return 0 }
|
func (m PlaceholderMessage) Index() int { return 0 }
|
||||||
func (m PlaceholderMessage) Syntax() pref.Syntax { return 0 }
|
func (m PlaceholderMessage) Syntax() protoreflect.Syntax { return 0 }
|
||||||
func (m PlaceholderMessage) Name() pref.Name { return pref.FullName(m).Name() }
|
func (m PlaceholderMessage) Name() protoreflect.Name { return protoreflect.FullName(m).Name() }
|
||||||
func (m PlaceholderMessage) FullName() pref.FullName { return pref.FullName(m) }
|
func (m PlaceholderMessage) FullName() protoreflect.FullName { return protoreflect.FullName(m) }
|
||||||
func (m PlaceholderMessage) IsPlaceholder() bool { return true }
|
func (m PlaceholderMessage) IsPlaceholder() bool { return true }
|
||||||
func (m PlaceholderMessage) Options() pref.ProtoMessage { return descopts.Message }
|
func (m PlaceholderMessage) Options() protoreflect.ProtoMessage { return descopts.Message }
|
||||||
func (m PlaceholderMessage) IsMapEntry() bool { return false }
|
func (m PlaceholderMessage) IsMapEntry() bool { return false }
|
||||||
func (m PlaceholderMessage) Fields() pref.FieldDescriptors { return emptyFields }
|
func (m PlaceholderMessage) Fields() protoreflect.FieldDescriptors { return emptyFields }
|
||||||
func (m PlaceholderMessage) Oneofs() pref.OneofDescriptors { return emptyOneofs }
|
func (m PlaceholderMessage) Oneofs() protoreflect.OneofDescriptors { return emptyOneofs }
|
||||||
func (m PlaceholderMessage) ReservedNames() pref.Names { return emptyNames }
|
func (m PlaceholderMessage) ReservedNames() protoreflect.Names { return emptyNames }
|
||||||
func (m PlaceholderMessage) ReservedRanges() pref.FieldRanges { return emptyFieldRanges }
|
func (m PlaceholderMessage) ReservedRanges() protoreflect.FieldRanges { return emptyFieldRanges }
|
||||||
func (m PlaceholderMessage) RequiredNumbers() pref.FieldNumbers { return emptyFieldNumbers }
|
func (m PlaceholderMessage) RequiredNumbers() protoreflect.FieldNumbers { return emptyFieldNumbers }
|
||||||
func (m PlaceholderMessage) ExtensionRanges() pref.FieldRanges { return emptyFieldRanges }
|
func (m PlaceholderMessage) ExtensionRanges() protoreflect.FieldRanges { return emptyFieldRanges }
|
||||||
func (m PlaceholderMessage) ExtensionRangeOptions(int) pref.ProtoMessage { panic("index out of range") }
|
func (m PlaceholderMessage) ExtensionRangeOptions(int) protoreflect.ProtoMessage {
|
||||||
func (m PlaceholderMessage) Messages() pref.MessageDescriptors { return emptyMessages }
|
panic("index out of range")
|
||||||
func (m PlaceholderMessage) Enums() pref.EnumDescriptors { return emptyEnums }
|
}
|
||||||
func (m PlaceholderMessage) Extensions() pref.ExtensionDescriptors { return emptyExtensions }
|
func (m PlaceholderMessage) Messages() protoreflect.MessageDescriptors { return emptyMessages }
|
||||||
func (m PlaceholderMessage) ProtoType(pref.MessageDescriptor) { return }
|
func (m PlaceholderMessage) Enums() protoreflect.EnumDescriptors { return emptyEnums }
|
||||||
func (m PlaceholderMessage) ProtoInternal(pragma.DoNotImplement) { return }
|
func (m PlaceholderMessage) Extensions() protoreflect.ExtensionDescriptors { return emptyExtensions }
|
||||||
|
func (m PlaceholderMessage) ProtoType(protoreflect.MessageDescriptor) { return }
|
||||||
|
func (m PlaceholderMessage) ProtoInternal(pragma.DoNotImplement) { return }
|
||||||
|
|
|
||||||
87
vendor/google.golang.org/protobuf/internal/filetype/build.go
generated
vendored
87
vendor/google.golang.org/protobuf/internal/filetype/build.go
generated
vendored
|
|
@ -10,17 +10,16 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"google.golang.org/protobuf/internal/descopts"
|
"google.golang.org/protobuf/internal/descopts"
|
||||||
fdesc "google.golang.org/protobuf/internal/filedesc"
|
"google.golang.org/protobuf/internal/filedesc"
|
||||||
pimpl "google.golang.org/protobuf/internal/impl"
|
pimpl "google.golang.org/protobuf/internal/impl"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Builder constructs type descriptors from a raw file descriptor
|
// Builder constructs type descriptors from a raw file descriptor
|
||||||
// and associated Go types for each enum and message declaration.
|
// and associated Go types for each enum and message declaration.
|
||||||
//
|
//
|
||||||
//
|
// # Flattened Ordering
|
||||||
// Flattened Ordering
|
|
||||||
//
|
//
|
||||||
// The protobuf type system represents declarations as a tree. Certain nodes in
|
// The protobuf type system represents declarations as a tree. Certain nodes in
|
||||||
// the tree require us to either associate it with a concrete Go type or to
|
// the tree require us to either associate it with a concrete Go type or to
|
||||||
|
|
@ -52,7 +51,7 @@ import (
|
||||||
// that children themselves may have.
|
// that children themselves may have.
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
// File is the underlying file descriptor builder.
|
// File is the underlying file descriptor builder.
|
||||||
File fdesc.Builder
|
File filedesc.Builder
|
||||||
|
|
||||||
// GoTypes is a unique set of the Go types for all declarations and
|
// GoTypes is a unique set of the Go types for all declarations and
|
||||||
// dependencies. Each type is represented as a zero value of the Go type.
|
// dependencies. Each type is represented as a zero value of the Go type.
|
||||||
|
|
@ -108,22 +107,22 @@ type Builder struct {
|
||||||
// TypeRegistry is the registry to register each type descriptor.
|
// TypeRegistry is the registry to register each type descriptor.
|
||||||
// If nil, it uses protoregistry.GlobalTypes.
|
// If nil, it uses protoregistry.GlobalTypes.
|
||||||
TypeRegistry interface {
|
TypeRegistry interface {
|
||||||
RegisterMessage(pref.MessageType) error
|
RegisterMessage(protoreflect.MessageType) error
|
||||||
RegisterEnum(pref.EnumType) error
|
RegisterEnum(protoreflect.EnumType) error
|
||||||
RegisterExtension(pref.ExtensionType) error
|
RegisterExtension(protoreflect.ExtensionType) error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Out is the output of the builder.
|
// Out is the output of the builder.
|
||||||
type Out struct {
|
type Out struct {
|
||||||
File pref.FileDescriptor
|
File protoreflect.FileDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tb Builder) Build() (out Out) {
|
func (tb Builder) Build() (out Out) {
|
||||||
// Replace the resolver with one that resolves dependencies by index,
|
// Replace the resolver with one that resolves dependencies by index,
|
||||||
// which is faster and more reliable than relying on the global registry.
|
// which is faster and more reliable than relying on the global registry.
|
||||||
if tb.File.FileRegistry == nil {
|
if tb.File.FileRegistry == nil {
|
||||||
tb.File.FileRegistry = preg.GlobalFiles
|
tb.File.FileRegistry = protoregistry.GlobalFiles
|
||||||
}
|
}
|
||||||
tb.File.FileRegistry = &resolverByIndex{
|
tb.File.FileRegistry = &resolverByIndex{
|
||||||
goTypes: tb.GoTypes,
|
goTypes: tb.GoTypes,
|
||||||
|
|
@ -133,7 +132,7 @@ func (tb Builder) Build() (out Out) {
|
||||||
|
|
||||||
// Initialize registry if unpopulated.
|
// Initialize registry if unpopulated.
|
||||||
if tb.TypeRegistry == nil {
|
if tb.TypeRegistry == nil {
|
||||||
tb.TypeRegistry = preg.GlobalTypes
|
tb.TypeRegistry = protoregistry.GlobalTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
fbOut := tb.File.Build()
|
fbOut := tb.File.Build()
|
||||||
|
|
@ -183,23 +182,23 @@ func (tb Builder) Build() (out Out) {
|
||||||
for i := range fbOut.Messages {
|
for i := range fbOut.Messages {
|
||||||
switch fbOut.Messages[i].Name() {
|
switch fbOut.Messages[i].Name() {
|
||||||
case "FileOptions":
|
case "FileOptions":
|
||||||
descopts.File = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.File = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "EnumOptions":
|
case "EnumOptions":
|
||||||
descopts.Enum = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.Enum = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "EnumValueOptions":
|
case "EnumValueOptions":
|
||||||
descopts.EnumValue = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.EnumValue = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "MessageOptions":
|
case "MessageOptions":
|
||||||
descopts.Message = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.Message = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "FieldOptions":
|
case "FieldOptions":
|
||||||
descopts.Field = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.Field = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "OneofOptions":
|
case "OneofOptions":
|
||||||
descopts.Oneof = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.Oneof = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "ExtensionRangeOptions":
|
case "ExtensionRangeOptions":
|
||||||
descopts.ExtensionRange = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.ExtensionRange = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "ServiceOptions":
|
case "ServiceOptions":
|
||||||
descopts.Service = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.Service = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "MethodOptions":
|
case "MethodOptions":
|
||||||
descopts.Method = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.Method = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -216,11 +215,11 @@ func (tb Builder) Build() (out Out) {
|
||||||
const listExtDeps = 2
|
const listExtDeps = 2
|
||||||
var goType reflect.Type
|
var goType reflect.Type
|
||||||
switch fbOut.Extensions[i].L1.Kind {
|
switch fbOut.Extensions[i].L1.Kind {
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)
|
j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)
|
||||||
goType = reflect.TypeOf(tb.GoTypes[j])
|
goType = reflect.TypeOf(tb.GoTypes[j])
|
||||||
depIdx++
|
depIdx++
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)
|
j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)
|
||||||
goType = reflect.TypeOf(tb.GoTypes[j])
|
goType = reflect.TypeOf(tb.GoTypes[j])
|
||||||
depIdx++
|
depIdx++
|
||||||
|
|
@ -242,22 +241,22 @@ func (tb Builder) Build() (out Out) {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
var goTypeForPBKind = map[pref.Kind]reflect.Type{
|
var goTypeForPBKind = map[protoreflect.Kind]reflect.Type{
|
||||||
pref.BoolKind: reflect.TypeOf(bool(false)),
|
protoreflect.BoolKind: reflect.TypeOf(bool(false)),
|
||||||
pref.Int32Kind: reflect.TypeOf(int32(0)),
|
protoreflect.Int32Kind: reflect.TypeOf(int32(0)),
|
||||||
pref.Sint32Kind: reflect.TypeOf(int32(0)),
|
protoreflect.Sint32Kind: reflect.TypeOf(int32(0)),
|
||||||
pref.Sfixed32Kind: reflect.TypeOf(int32(0)),
|
protoreflect.Sfixed32Kind: reflect.TypeOf(int32(0)),
|
||||||
pref.Int64Kind: reflect.TypeOf(int64(0)),
|
protoreflect.Int64Kind: reflect.TypeOf(int64(0)),
|
||||||
pref.Sint64Kind: reflect.TypeOf(int64(0)),
|
protoreflect.Sint64Kind: reflect.TypeOf(int64(0)),
|
||||||
pref.Sfixed64Kind: reflect.TypeOf(int64(0)),
|
protoreflect.Sfixed64Kind: reflect.TypeOf(int64(0)),
|
||||||
pref.Uint32Kind: reflect.TypeOf(uint32(0)),
|
protoreflect.Uint32Kind: reflect.TypeOf(uint32(0)),
|
||||||
pref.Fixed32Kind: reflect.TypeOf(uint32(0)),
|
protoreflect.Fixed32Kind: reflect.TypeOf(uint32(0)),
|
||||||
pref.Uint64Kind: reflect.TypeOf(uint64(0)),
|
protoreflect.Uint64Kind: reflect.TypeOf(uint64(0)),
|
||||||
pref.Fixed64Kind: reflect.TypeOf(uint64(0)),
|
protoreflect.Fixed64Kind: reflect.TypeOf(uint64(0)),
|
||||||
pref.FloatKind: reflect.TypeOf(float32(0)),
|
protoreflect.FloatKind: reflect.TypeOf(float32(0)),
|
||||||
pref.DoubleKind: reflect.TypeOf(float64(0)),
|
protoreflect.DoubleKind: reflect.TypeOf(float64(0)),
|
||||||
pref.StringKind: reflect.TypeOf(string("")),
|
protoreflect.StringKind: reflect.TypeOf(string("")),
|
||||||
pref.BytesKind: reflect.TypeOf([]byte(nil)),
|
protoreflect.BytesKind: reflect.TypeOf([]byte(nil)),
|
||||||
}
|
}
|
||||||
|
|
||||||
type depIdxs []int32
|
type depIdxs []int32
|
||||||
|
|
@ -274,13 +273,13 @@ type (
|
||||||
fileRegistry
|
fileRegistry
|
||||||
}
|
}
|
||||||
fileRegistry interface {
|
fileRegistry interface {
|
||||||
FindFileByPath(string) (pref.FileDescriptor, error)
|
FindFileByPath(string) (protoreflect.FileDescriptor, error)
|
||||||
FindDescriptorByName(pref.FullName) (pref.Descriptor, error)
|
FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)
|
||||||
RegisterFile(pref.FileDescriptor) error
|
RegisterFile(protoreflect.FileDescriptor) error
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (r *resolverByIndex) FindEnumByIndex(i, j int32, es []fdesc.Enum, ms []fdesc.Message) pref.EnumDescriptor {
|
func (r *resolverByIndex) FindEnumByIndex(i, j int32, es []filedesc.Enum, ms []filedesc.Message) protoreflect.EnumDescriptor {
|
||||||
if depIdx := int(r.depIdxs.Get(i, j)); int(depIdx) < len(es)+len(ms) {
|
if depIdx := int(r.depIdxs.Get(i, j)); int(depIdx) < len(es)+len(ms) {
|
||||||
return &es[depIdx]
|
return &es[depIdx]
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -288,7 +287,7 @@ func (r *resolverByIndex) FindEnumByIndex(i, j int32, es []fdesc.Enum, ms []fdes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *resolverByIndex) FindMessageByIndex(i, j int32, es []fdesc.Enum, ms []fdesc.Message) pref.MessageDescriptor {
|
func (r *resolverByIndex) FindMessageByIndex(i, j int32, es []filedesc.Enum, ms []filedesc.Message) protoreflect.MessageDescriptor {
|
||||||
if depIdx := int(r.depIdxs.Get(i, j)); depIdx < len(es)+len(ms) {
|
if depIdx := int(r.depIdxs.Get(i, j)); depIdx < len(es)+len(ms) {
|
||||||
return &ms[depIdx-len(es)]
|
return &ms[depIdx-len(es)]
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
1
vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go
generated
vendored
1
vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !protolegacy
|
||||||
// +build !protolegacy
|
// +build !protolegacy
|
||||||
|
|
||||||
package flags
|
package flags
|
||||||
|
|
|
||||||
1
vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go
generated
vendored
1
vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build protolegacy
|
||||||
// +build protolegacy
|
// +build protolegacy
|
||||||
|
|
||||||
package flags
|
package flags
|
||||||
|
|
|
||||||
492
vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go
generated
vendored
492
vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go
generated
vendored
|
|
@ -12,6 +12,28 @@ import (
|
||||||
|
|
||||||
const File_google_protobuf_descriptor_proto = "google/protobuf/descriptor.proto"
|
const File_google_protobuf_descriptor_proto = "google/protobuf/descriptor.proto"
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.Edition.
|
||||||
|
const (
|
||||||
|
Edition_enum_fullname = "google.protobuf.Edition"
|
||||||
|
Edition_enum_name = "Edition"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.Edition.
|
||||||
|
const (
|
||||||
|
Edition_EDITION_UNKNOWN_enum_value = 0
|
||||||
|
Edition_EDITION_LEGACY_enum_value = 900
|
||||||
|
Edition_EDITION_PROTO2_enum_value = 998
|
||||||
|
Edition_EDITION_PROTO3_enum_value = 999
|
||||||
|
Edition_EDITION_2023_enum_value = 1000
|
||||||
|
Edition_EDITION_2024_enum_value = 1001
|
||||||
|
Edition_EDITION_1_TEST_ONLY_enum_value = 1
|
||||||
|
Edition_EDITION_2_TEST_ONLY_enum_value = 2
|
||||||
|
Edition_EDITION_99997_TEST_ONLY_enum_value = 99997
|
||||||
|
Edition_EDITION_99998_TEST_ONLY_enum_value = 99998
|
||||||
|
Edition_EDITION_99999_TEST_ONLY_enum_value = 99999
|
||||||
|
Edition_EDITION_MAX_enum_value = 2147483647
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.FileDescriptorSet.
|
// Names for google.protobuf.FileDescriptorSet.
|
||||||
const (
|
const (
|
||||||
FileDescriptorSet_message_name protoreflect.Name = "FileDescriptorSet"
|
FileDescriptorSet_message_name protoreflect.Name = "FileDescriptorSet"
|
||||||
|
|
@ -50,6 +72,7 @@ const (
|
||||||
FileDescriptorProto_Options_field_name protoreflect.Name = "options"
|
FileDescriptorProto_Options_field_name protoreflect.Name = "options"
|
||||||
FileDescriptorProto_SourceCodeInfo_field_name protoreflect.Name = "source_code_info"
|
FileDescriptorProto_SourceCodeInfo_field_name protoreflect.Name = "source_code_info"
|
||||||
FileDescriptorProto_Syntax_field_name protoreflect.Name = "syntax"
|
FileDescriptorProto_Syntax_field_name protoreflect.Name = "syntax"
|
||||||
|
FileDescriptorProto_Edition_field_name protoreflect.Name = "edition"
|
||||||
|
|
||||||
FileDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.name"
|
FileDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.name"
|
||||||
FileDescriptorProto_Package_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.package"
|
FileDescriptorProto_Package_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.package"
|
||||||
|
|
@ -63,6 +86,7 @@ const (
|
||||||
FileDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.options"
|
FileDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.options"
|
||||||
FileDescriptorProto_SourceCodeInfo_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.source_code_info"
|
FileDescriptorProto_SourceCodeInfo_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.source_code_info"
|
||||||
FileDescriptorProto_Syntax_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.syntax"
|
FileDescriptorProto_Syntax_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.syntax"
|
||||||
|
FileDescriptorProto_Edition_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.edition"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.FileDescriptorProto.
|
// Field numbers for google.protobuf.FileDescriptorProto.
|
||||||
|
|
@ -79,6 +103,7 @@ const (
|
||||||
FileDescriptorProto_Options_field_number protoreflect.FieldNumber = 8
|
FileDescriptorProto_Options_field_number protoreflect.FieldNumber = 8
|
||||||
FileDescriptorProto_SourceCodeInfo_field_number protoreflect.FieldNumber = 9
|
FileDescriptorProto_SourceCodeInfo_field_number protoreflect.FieldNumber = 9
|
||||||
FileDescriptorProto_Syntax_field_number protoreflect.FieldNumber = 12
|
FileDescriptorProto_Syntax_field_number protoreflect.FieldNumber = 12
|
||||||
|
FileDescriptorProto_Edition_field_number protoreflect.FieldNumber = 14
|
||||||
)
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.DescriptorProto.
|
// Names for google.protobuf.DescriptorProto.
|
||||||
|
|
@ -180,13 +205,64 @@ const (
|
||||||
// Field names for google.protobuf.ExtensionRangeOptions.
|
// Field names for google.protobuf.ExtensionRangeOptions.
|
||||||
const (
|
const (
|
||||||
ExtensionRangeOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
ExtensionRangeOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
ExtensionRangeOptions_Declaration_field_name protoreflect.Name = "declaration"
|
||||||
|
ExtensionRangeOptions_Features_field_name protoreflect.Name = "features"
|
||||||
|
ExtensionRangeOptions_Verification_field_name protoreflect.Name = "verification"
|
||||||
|
|
||||||
ExtensionRangeOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.uninterpreted_option"
|
ExtensionRangeOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.uninterpreted_option"
|
||||||
|
ExtensionRangeOptions_Declaration_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.declaration"
|
||||||
|
ExtensionRangeOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.features"
|
||||||
|
ExtensionRangeOptions_Verification_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.verification"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.ExtensionRangeOptions.
|
// Field numbers for google.protobuf.ExtensionRangeOptions.
|
||||||
const (
|
const (
|
||||||
ExtensionRangeOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
ExtensionRangeOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
|
ExtensionRangeOptions_Declaration_field_number protoreflect.FieldNumber = 2
|
||||||
|
ExtensionRangeOptions_Features_field_number protoreflect.FieldNumber = 50
|
||||||
|
ExtensionRangeOptions_Verification_field_number protoreflect.FieldNumber = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.ExtensionRangeOptions.VerificationState.
|
||||||
|
const (
|
||||||
|
ExtensionRangeOptions_VerificationState_enum_fullname = "google.protobuf.ExtensionRangeOptions.VerificationState"
|
||||||
|
ExtensionRangeOptions_VerificationState_enum_name = "VerificationState"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.ExtensionRangeOptions.VerificationState.
|
||||||
|
const (
|
||||||
|
ExtensionRangeOptions_DECLARATION_enum_value = 0
|
||||||
|
ExtensionRangeOptions_UNVERIFIED_enum_value = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
// Names for google.protobuf.ExtensionRangeOptions.Declaration.
|
||||||
|
const (
|
||||||
|
ExtensionRangeOptions_Declaration_message_name protoreflect.Name = "Declaration"
|
||||||
|
ExtensionRangeOptions_Declaration_message_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field names for google.protobuf.ExtensionRangeOptions.Declaration.
|
||||||
|
const (
|
||||||
|
ExtensionRangeOptions_Declaration_Number_field_name protoreflect.Name = "number"
|
||||||
|
ExtensionRangeOptions_Declaration_FullName_field_name protoreflect.Name = "full_name"
|
||||||
|
ExtensionRangeOptions_Declaration_Type_field_name protoreflect.Name = "type"
|
||||||
|
ExtensionRangeOptions_Declaration_Reserved_field_name protoreflect.Name = "reserved"
|
||||||
|
ExtensionRangeOptions_Declaration_Repeated_field_name protoreflect.Name = "repeated"
|
||||||
|
|
||||||
|
ExtensionRangeOptions_Declaration_Number_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.number"
|
||||||
|
ExtensionRangeOptions_Declaration_FullName_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.full_name"
|
||||||
|
ExtensionRangeOptions_Declaration_Type_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.type"
|
||||||
|
ExtensionRangeOptions_Declaration_Reserved_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.reserved"
|
||||||
|
ExtensionRangeOptions_Declaration_Repeated_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.repeated"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.ExtensionRangeOptions.Declaration.
|
||||||
|
const (
|
||||||
|
ExtensionRangeOptions_Declaration_Number_field_number protoreflect.FieldNumber = 1
|
||||||
|
ExtensionRangeOptions_Declaration_FullName_field_number protoreflect.FieldNumber = 2
|
||||||
|
ExtensionRangeOptions_Declaration_Type_field_number protoreflect.FieldNumber = 3
|
||||||
|
ExtensionRangeOptions_Declaration_Reserved_field_number protoreflect.FieldNumber = 5
|
||||||
|
ExtensionRangeOptions_Declaration_Repeated_field_number protoreflect.FieldNumber = 6
|
||||||
)
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.FieldDescriptorProto.
|
// Names for google.protobuf.FieldDescriptorProto.
|
||||||
|
|
@ -243,12 +319,41 @@ const (
|
||||||
FieldDescriptorProto_Type_enum_name = "Type"
|
FieldDescriptorProto_Type_enum_name = "Type"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FieldDescriptorProto.Type.
|
||||||
|
const (
|
||||||
|
FieldDescriptorProto_TYPE_DOUBLE_enum_value = 1
|
||||||
|
FieldDescriptorProto_TYPE_FLOAT_enum_value = 2
|
||||||
|
FieldDescriptorProto_TYPE_INT64_enum_value = 3
|
||||||
|
FieldDescriptorProto_TYPE_UINT64_enum_value = 4
|
||||||
|
FieldDescriptorProto_TYPE_INT32_enum_value = 5
|
||||||
|
FieldDescriptorProto_TYPE_FIXED64_enum_value = 6
|
||||||
|
FieldDescriptorProto_TYPE_FIXED32_enum_value = 7
|
||||||
|
FieldDescriptorProto_TYPE_BOOL_enum_value = 8
|
||||||
|
FieldDescriptorProto_TYPE_STRING_enum_value = 9
|
||||||
|
FieldDescriptorProto_TYPE_GROUP_enum_value = 10
|
||||||
|
FieldDescriptorProto_TYPE_MESSAGE_enum_value = 11
|
||||||
|
FieldDescriptorProto_TYPE_BYTES_enum_value = 12
|
||||||
|
FieldDescriptorProto_TYPE_UINT32_enum_value = 13
|
||||||
|
FieldDescriptorProto_TYPE_ENUM_enum_value = 14
|
||||||
|
FieldDescriptorProto_TYPE_SFIXED32_enum_value = 15
|
||||||
|
FieldDescriptorProto_TYPE_SFIXED64_enum_value = 16
|
||||||
|
FieldDescriptorProto_TYPE_SINT32_enum_value = 17
|
||||||
|
FieldDescriptorProto_TYPE_SINT64_enum_value = 18
|
||||||
|
)
|
||||||
|
|
||||||
// Full and short names for google.protobuf.FieldDescriptorProto.Label.
|
// Full and short names for google.protobuf.FieldDescriptorProto.Label.
|
||||||
const (
|
const (
|
||||||
FieldDescriptorProto_Label_enum_fullname = "google.protobuf.FieldDescriptorProto.Label"
|
FieldDescriptorProto_Label_enum_fullname = "google.protobuf.FieldDescriptorProto.Label"
|
||||||
FieldDescriptorProto_Label_enum_name = "Label"
|
FieldDescriptorProto_Label_enum_name = "Label"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FieldDescriptorProto.Label.
|
||||||
|
const (
|
||||||
|
FieldDescriptorProto_LABEL_OPTIONAL_enum_value = 1
|
||||||
|
FieldDescriptorProto_LABEL_REPEATED_enum_value = 3
|
||||||
|
FieldDescriptorProto_LABEL_REQUIRED_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.OneofDescriptorProto.
|
// Names for google.protobuf.OneofDescriptorProto.
|
||||||
const (
|
const (
|
||||||
OneofDescriptorProto_message_name protoreflect.Name = "OneofDescriptorProto"
|
OneofDescriptorProto_message_name protoreflect.Name = "OneofDescriptorProto"
|
||||||
|
|
@ -420,7 +525,6 @@ const (
|
||||||
FileOptions_CcGenericServices_field_name protoreflect.Name = "cc_generic_services"
|
FileOptions_CcGenericServices_field_name protoreflect.Name = "cc_generic_services"
|
||||||
FileOptions_JavaGenericServices_field_name protoreflect.Name = "java_generic_services"
|
FileOptions_JavaGenericServices_field_name protoreflect.Name = "java_generic_services"
|
||||||
FileOptions_PyGenericServices_field_name protoreflect.Name = "py_generic_services"
|
FileOptions_PyGenericServices_field_name protoreflect.Name = "py_generic_services"
|
||||||
FileOptions_PhpGenericServices_field_name protoreflect.Name = "php_generic_services"
|
|
||||||
FileOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
FileOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
FileOptions_CcEnableArenas_field_name protoreflect.Name = "cc_enable_arenas"
|
FileOptions_CcEnableArenas_field_name protoreflect.Name = "cc_enable_arenas"
|
||||||
FileOptions_ObjcClassPrefix_field_name protoreflect.Name = "objc_class_prefix"
|
FileOptions_ObjcClassPrefix_field_name protoreflect.Name = "objc_class_prefix"
|
||||||
|
|
@ -430,6 +534,7 @@ const (
|
||||||
FileOptions_PhpNamespace_field_name protoreflect.Name = "php_namespace"
|
FileOptions_PhpNamespace_field_name protoreflect.Name = "php_namespace"
|
||||||
FileOptions_PhpMetadataNamespace_field_name protoreflect.Name = "php_metadata_namespace"
|
FileOptions_PhpMetadataNamespace_field_name protoreflect.Name = "php_metadata_namespace"
|
||||||
FileOptions_RubyPackage_field_name protoreflect.Name = "ruby_package"
|
FileOptions_RubyPackage_field_name protoreflect.Name = "ruby_package"
|
||||||
|
FileOptions_Features_field_name protoreflect.Name = "features"
|
||||||
FileOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
FileOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
FileOptions_JavaPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_package"
|
FileOptions_JavaPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_package"
|
||||||
|
|
@ -442,7 +547,6 @@ const (
|
||||||
FileOptions_CcGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_generic_services"
|
FileOptions_CcGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_generic_services"
|
||||||
FileOptions_JavaGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_generic_services"
|
FileOptions_JavaGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_generic_services"
|
||||||
FileOptions_PyGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.py_generic_services"
|
FileOptions_PyGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.py_generic_services"
|
||||||
FileOptions_PhpGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_generic_services"
|
|
||||||
FileOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.deprecated"
|
FileOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.deprecated"
|
||||||
FileOptions_CcEnableArenas_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_enable_arenas"
|
FileOptions_CcEnableArenas_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_enable_arenas"
|
||||||
FileOptions_ObjcClassPrefix_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.objc_class_prefix"
|
FileOptions_ObjcClassPrefix_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.objc_class_prefix"
|
||||||
|
|
@ -452,6 +556,7 @@ const (
|
||||||
FileOptions_PhpNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_namespace"
|
FileOptions_PhpNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_namespace"
|
||||||
FileOptions_PhpMetadataNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_metadata_namespace"
|
FileOptions_PhpMetadataNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_metadata_namespace"
|
||||||
FileOptions_RubyPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.ruby_package"
|
FileOptions_RubyPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.ruby_package"
|
||||||
|
FileOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.features"
|
||||||
FileOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.uninterpreted_option"
|
FileOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -467,7 +572,6 @@ const (
|
||||||
FileOptions_CcGenericServices_field_number protoreflect.FieldNumber = 16
|
FileOptions_CcGenericServices_field_number protoreflect.FieldNumber = 16
|
||||||
FileOptions_JavaGenericServices_field_number protoreflect.FieldNumber = 17
|
FileOptions_JavaGenericServices_field_number protoreflect.FieldNumber = 17
|
||||||
FileOptions_PyGenericServices_field_number protoreflect.FieldNumber = 18
|
FileOptions_PyGenericServices_field_number protoreflect.FieldNumber = 18
|
||||||
FileOptions_PhpGenericServices_field_number protoreflect.FieldNumber = 42
|
|
||||||
FileOptions_Deprecated_field_number protoreflect.FieldNumber = 23
|
FileOptions_Deprecated_field_number protoreflect.FieldNumber = 23
|
||||||
FileOptions_CcEnableArenas_field_number protoreflect.FieldNumber = 31
|
FileOptions_CcEnableArenas_field_number protoreflect.FieldNumber = 31
|
||||||
FileOptions_ObjcClassPrefix_field_number protoreflect.FieldNumber = 36
|
FileOptions_ObjcClassPrefix_field_number protoreflect.FieldNumber = 36
|
||||||
|
|
@ -477,6 +581,7 @@ const (
|
||||||
FileOptions_PhpNamespace_field_number protoreflect.FieldNumber = 41
|
FileOptions_PhpNamespace_field_number protoreflect.FieldNumber = 41
|
||||||
FileOptions_PhpMetadataNamespace_field_number protoreflect.FieldNumber = 44
|
FileOptions_PhpMetadataNamespace_field_number protoreflect.FieldNumber = 44
|
||||||
FileOptions_RubyPackage_field_number protoreflect.FieldNumber = 45
|
FileOptions_RubyPackage_field_number protoreflect.FieldNumber = 45
|
||||||
|
FileOptions_Features_field_number protoreflect.FieldNumber = 50
|
||||||
FileOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
FileOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -486,6 +591,13 @@ const (
|
||||||
FileOptions_OptimizeMode_enum_name = "OptimizeMode"
|
FileOptions_OptimizeMode_enum_name = "OptimizeMode"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FileOptions.OptimizeMode.
|
||||||
|
const (
|
||||||
|
FileOptions_SPEED_enum_value = 1
|
||||||
|
FileOptions_CODE_SIZE_enum_value = 2
|
||||||
|
FileOptions_LITE_RUNTIME_enum_value = 3
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.MessageOptions.
|
// Names for google.protobuf.MessageOptions.
|
||||||
const (
|
const (
|
||||||
MessageOptions_message_name protoreflect.Name = "MessageOptions"
|
MessageOptions_message_name protoreflect.Name = "MessageOptions"
|
||||||
|
|
@ -494,26 +606,32 @@ const (
|
||||||
|
|
||||||
// Field names for google.protobuf.MessageOptions.
|
// Field names for google.protobuf.MessageOptions.
|
||||||
const (
|
const (
|
||||||
MessageOptions_MessageSetWireFormat_field_name protoreflect.Name = "message_set_wire_format"
|
MessageOptions_MessageSetWireFormat_field_name protoreflect.Name = "message_set_wire_format"
|
||||||
MessageOptions_NoStandardDescriptorAccessor_field_name protoreflect.Name = "no_standard_descriptor_accessor"
|
MessageOptions_NoStandardDescriptorAccessor_field_name protoreflect.Name = "no_standard_descriptor_accessor"
|
||||||
MessageOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
MessageOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
MessageOptions_MapEntry_field_name protoreflect.Name = "map_entry"
|
MessageOptions_MapEntry_field_name protoreflect.Name = "map_entry"
|
||||||
MessageOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_name protoreflect.Name = "deprecated_legacy_json_field_conflicts"
|
||||||
|
MessageOptions_Features_field_name protoreflect.Name = "features"
|
||||||
|
MessageOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
MessageOptions_MessageSetWireFormat_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.message_set_wire_format"
|
MessageOptions_MessageSetWireFormat_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.message_set_wire_format"
|
||||||
MessageOptions_NoStandardDescriptorAccessor_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.no_standard_descriptor_accessor"
|
MessageOptions_NoStandardDescriptorAccessor_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.no_standard_descriptor_accessor"
|
||||||
MessageOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated"
|
MessageOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated"
|
||||||
MessageOptions_MapEntry_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.map_entry"
|
MessageOptions_MapEntry_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.map_entry"
|
||||||
MessageOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.uninterpreted_option"
|
MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated_legacy_json_field_conflicts"
|
||||||
|
MessageOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.features"
|
||||||
|
MessageOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.MessageOptions.
|
// Field numbers for google.protobuf.MessageOptions.
|
||||||
const (
|
const (
|
||||||
MessageOptions_MessageSetWireFormat_field_number protoreflect.FieldNumber = 1
|
MessageOptions_MessageSetWireFormat_field_number protoreflect.FieldNumber = 1
|
||||||
MessageOptions_NoStandardDescriptorAccessor_field_number protoreflect.FieldNumber = 2
|
MessageOptions_NoStandardDescriptorAccessor_field_number protoreflect.FieldNumber = 2
|
||||||
MessageOptions_Deprecated_field_number protoreflect.FieldNumber = 3
|
MessageOptions_Deprecated_field_number protoreflect.FieldNumber = 3
|
||||||
MessageOptions_MapEntry_field_number protoreflect.FieldNumber = 7
|
MessageOptions_MapEntry_field_number protoreflect.FieldNumber = 7
|
||||||
MessageOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_number protoreflect.FieldNumber = 11
|
||||||
|
MessageOptions_Features_field_number protoreflect.FieldNumber = 12
|
||||||
|
MessageOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.FieldOptions.
|
// Names for google.protobuf.FieldOptions.
|
||||||
|
|
@ -528,16 +646,30 @@ const (
|
||||||
FieldOptions_Packed_field_name protoreflect.Name = "packed"
|
FieldOptions_Packed_field_name protoreflect.Name = "packed"
|
||||||
FieldOptions_Jstype_field_name protoreflect.Name = "jstype"
|
FieldOptions_Jstype_field_name protoreflect.Name = "jstype"
|
||||||
FieldOptions_Lazy_field_name protoreflect.Name = "lazy"
|
FieldOptions_Lazy_field_name protoreflect.Name = "lazy"
|
||||||
|
FieldOptions_UnverifiedLazy_field_name protoreflect.Name = "unverified_lazy"
|
||||||
FieldOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
FieldOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
FieldOptions_Weak_field_name protoreflect.Name = "weak"
|
FieldOptions_Weak_field_name protoreflect.Name = "weak"
|
||||||
|
FieldOptions_DebugRedact_field_name protoreflect.Name = "debug_redact"
|
||||||
|
FieldOptions_Retention_field_name protoreflect.Name = "retention"
|
||||||
|
FieldOptions_Targets_field_name protoreflect.Name = "targets"
|
||||||
|
FieldOptions_EditionDefaults_field_name protoreflect.Name = "edition_defaults"
|
||||||
|
FieldOptions_Features_field_name protoreflect.Name = "features"
|
||||||
|
FieldOptions_FeatureSupport_field_name protoreflect.Name = "feature_support"
|
||||||
FieldOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
FieldOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
FieldOptions_Ctype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.ctype"
|
FieldOptions_Ctype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.ctype"
|
||||||
FieldOptions_Packed_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.packed"
|
FieldOptions_Packed_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.packed"
|
||||||
FieldOptions_Jstype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.jstype"
|
FieldOptions_Jstype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.jstype"
|
||||||
FieldOptions_Lazy_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.lazy"
|
FieldOptions_Lazy_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.lazy"
|
||||||
|
FieldOptions_UnverifiedLazy_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.unverified_lazy"
|
||||||
FieldOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.deprecated"
|
FieldOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.deprecated"
|
||||||
FieldOptions_Weak_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.weak"
|
FieldOptions_Weak_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.weak"
|
||||||
|
FieldOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.debug_redact"
|
||||||
|
FieldOptions_Retention_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.retention"
|
||||||
|
FieldOptions_Targets_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.targets"
|
||||||
|
FieldOptions_EditionDefaults_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.edition_defaults"
|
||||||
|
FieldOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.features"
|
||||||
|
FieldOptions_FeatureSupport_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.feature_support"
|
||||||
FieldOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.uninterpreted_option"
|
FieldOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -547,8 +679,15 @@ const (
|
||||||
FieldOptions_Packed_field_number protoreflect.FieldNumber = 2
|
FieldOptions_Packed_field_number protoreflect.FieldNumber = 2
|
||||||
FieldOptions_Jstype_field_number protoreflect.FieldNumber = 6
|
FieldOptions_Jstype_field_number protoreflect.FieldNumber = 6
|
||||||
FieldOptions_Lazy_field_number protoreflect.FieldNumber = 5
|
FieldOptions_Lazy_field_number protoreflect.FieldNumber = 5
|
||||||
|
FieldOptions_UnverifiedLazy_field_number protoreflect.FieldNumber = 15
|
||||||
FieldOptions_Deprecated_field_number protoreflect.FieldNumber = 3
|
FieldOptions_Deprecated_field_number protoreflect.FieldNumber = 3
|
||||||
FieldOptions_Weak_field_number protoreflect.FieldNumber = 10
|
FieldOptions_Weak_field_number protoreflect.FieldNumber = 10
|
||||||
|
FieldOptions_DebugRedact_field_number protoreflect.FieldNumber = 16
|
||||||
|
FieldOptions_Retention_field_number protoreflect.FieldNumber = 17
|
||||||
|
FieldOptions_Targets_field_number protoreflect.FieldNumber = 19
|
||||||
|
FieldOptions_EditionDefaults_field_number protoreflect.FieldNumber = 20
|
||||||
|
FieldOptions_Features_field_number protoreflect.FieldNumber = 21
|
||||||
|
FieldOptions_FeatureSupport_field_number protoreflect.FieldNumber = 22
|
||||||
FieldOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
FieldOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -558,12 +697,107 @@ const (
|
||||||
FieldOptions_CType_enum_name = "CType"
|
FieldOptions_CType_enum_name = "CType"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FieldOptions.CType.
|
||||||
|
const (
|
||||||
|
FieldOptions_STRING_enum_value = 0
|
||||||
|
FieldOptions_CORD_enum_value = 1
|
||||||
|
FieldOptions_STRING_PIECE_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
// Full and short names for google.protobuf.FieldOptions.JSType.
|
// Full and short names for google.protobuf.FieldOptions.JSType.
|
||||||
const (
|
const (
|
||||||
FieldOptions_JSType_enum_fullname = "google.protobuf.FieldOptions.JSType"
|
FieldOptions_JSType_enum_fullname = "google.protobuf.FieldOptions.JSType"
|
||||||
FieldOptions_JSType_enum_name = "JSType"
|
FieldOptions_JSType_enum_name = "JSType"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FieldOptions.JSType.
|
||||||
|
const (
|
||||||
|
FieldOptions_JS_NORMAL_enum_value = 0
|
||||||
|
FieldOptions_JS_STRING_enum_value = 1
|
||||||
|
FieldOptions_JS_NUMBER_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FieldOptions.OptionRetention.
|
||||||
|
const (
|
||||||
|
FieldOptions_OptionRetention_enum_fullname = "google.protobuf.FieldOptions.OptionRetention"
|
||||||
|
FieldOptions_OptionRetention_enum_name = "OptionRetention"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FieldOptions.OptionRetention.
|
||||||
|
const (
|
||||||
|
FieldOptions_RETENTION_UNKNOWN_enum_value = 0
|
||||||
|
FieldOptions_RETENTION_RUNTIME_enum_value = 1
|
||||||
|
FieldOptions_RETENTION_SOURCE_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FieldOptions.OptionTargetType.
|
||||||
|
const (
|
||||||
|
FieldOptions_OptionTargetType_enum_fullname = "google.protobuf.FieldOptions.OptionTargetType"
|
||||||
|
FieldOptions_OptionTargetType_enum_name = "OptionTargetType"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FieldOptions.OptionTargetType.
|
||||||
|
const (
|
||||||
|
FieldOptions_TARGET_TYPE_UNKNOWN_enum_value = 0
|
||||||
|
FieldOptions_TARGET_TYPE_FILE_enum_value = 1
|
||||||
|
FieldOptions_TARGET_TYPE_EXTENSION_RANGE_enum_value = 2
|
||||||
|
FieldOptions_TARGET_TYPE_MESSAGE_enum_value = 3
|
||||||
|
FieldOptions_TARGET_TYPE_FIELD_enum_value = 4
|
||||||
|
FieldOptions_TARGET_TYPE_ONEOF_enum_value = 5
|
||||||
|
FieldOptions_TARGET_TYPE_ENUM_enum_value = 6
|
||||||
|
FieldOptions_TARGET_TYPE_ENUM_ENTRY_enum_value = 7
|
||||||
|
FieldOptions_TARGET_TYPE_SERVICE_enum_value = 8
|
||||||
|
FieldOptions_TARGET_TYPE_METHOD_enum_value = 9
|
||||||
|
)
|
||||||
|
|
||||||
|
// Names for google.protobuf.FieldOptions.EditionDefault.
|
||||||
|
const (
|
||||||
|
FieldOptions_EditionDefault_message_name protoreflect.Name = "EditionDefault"
|
||||||
|
FieldOptions_EditionDefault_message_fullname protoreflect.FullName = "google.protobuf.FieldOptions.EditionDefault"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field names for google.protobuf.FieldOptions.EditionDefault.
|
||||||
|
const (
|
||||||
|
FieldOptions_EditionDefault_Edition_field_name protoreflect.Name = "edition"
|
||||||
|
FieldOptions_EditionDefault_Value_field_name protoreflect.Name = "value"
|
||||||
|
|
||||||
|
FieldOptions_EditionDefault_Edition_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.EditionDefault.edition"
|
||||||
|
FieldOptions_EditionDefault_Value_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.EditionDefault.value"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.FieldOptions.EditionDefault.
|
||||||
|
const (
|
||||||
|
FieldOptions_EditionDefault_Edition_field_number protoreflect.FieldNumber = 3
|
||||||
|
FieldOptions_EditionDefault_Value_field_number protoreflect.FieldNumber = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// Names for google.protobuf.FieldOptions.FeatureSupport.
|
||||||
|
const (
|
||||||
|
FieldOptions_FeatureSupport_message_name protoreflect.Name = "FeatureSupport"
|
||||||
|
FieldOptions_FeatureSupport_message_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field names for google.protobuf.FieldOptions.FeatureSupport.
|
||||||
|
const (
|
||||||
|
FieldOptions_FeatureSupport_EditionIntroduced_field_name protoreflect.Name = "edition_introduced"
|
||||||
|
FieldOptions_FeatureSupport_EditionDeprecated_field_name protoreflect.Name = "edition_deprecated"
|
||||||
|
FieldOptions_FeatureSupport_DeprecationWarning_field_name protoreflect.Name = "deprecation_warning"
|
||||||
|
FieldOptions_FeatureSupport_EditionRemoved_field_name protoreflect.Name = "edition_removed"
|
||||||
|
|
||||||
|
FieldOptions_FeatureSupport_EditionIntroduced_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport.edition_introduced"
|
||||||
|
FieldOptions_FeatureSupport_EditionDeprecated_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport.edition_deprecated"
|
||||||
|
FieldOptions_FeatureSupport_DeprecationWarning_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport.deprecation_warning"
|
||||||
|
FieldOptions_FeatureSupport_EditionRemoved_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport.edition_removed"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.FieldOptions.FeatureSupport.
|
||||||
|
const (
|
||||||
|
FieldOptions_FeatureSupport_EditionIntroduced_field_number protoreflect.FieldNumber = 1
|
||||||
|
FieldOptions_FeatureSupport_EditionDeprecated_field_number protoreflect.FieldNumber = 2
|
||||||
|
FieldOptions_FeatureSupport_DeprecationWarning_field_number protoreflect.FieldNumber = 3
|
||||||
|
FieldOptions_FeatureSupport_EditionRemoved_field_number protoreflect.FieldNumber = 4
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.OneofOptions.
|
// Names for google.protobuf.OneofOptions.
|
||||||
const (
|
const (
|
||||||
OneofOptions_message_name protoreflect.Name = "OneofOptions"
|
OneofOptions_message_name protoreflect.Name = "OneofOptions"
|
||||||
|
|
@ -572,13 +806,16 @@ const (
|
||||||
|
|
||||||
// Field names for google.protobuf.OneofOptions.
|
// Field names for google.protobuf.OneofOptions.
|
||||||
const (
|
const (
|
||||||
|
OneofOptions_Features_field_name protoreflect.Name = "features"
|
||||||
OneofOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
OneofOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
|
OneofOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.OneofOptions.features"
|
||||||
OneofOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.OneofOptions.uninterpreted_option"
|
OneofOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.OneofOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.OneofOptions.
|
// Field numbers for google.protobuf.OneofOptions.
|
||||||
const (
|
const (
|
||||||
|
OneofOptions_Features_field_number protoreflect.FieldNumber = 1
|
||||||
OneofOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
OneofOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -590,20 +827,26 @@ const (
|
||||||
|
|
||||||
// Field names for google.protobuf.EnumOptions.
|
// Field names for google.protobuf.EnumOptions.
|
||||||
const (
|
const (
|
||||||
EnumOptions_AllowAlias_field_name protoreflect.Name = "allow_alias"
|
EnumOptions_AllowAlias_field_name protoreflect.Name = "allow_alias"
|
||||||
EnumOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
EnumOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
EnumOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_name protoreflect.Name = "deprecated_legacy_json_field_conflicts"
|
||||||
|
EnumOptions_Features_field_name protoreflect.Name = "features"
|
||||||
|
EnumOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
EnumOptions_AllowAlias_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.allow_alias"
|
EnumOptions_AllowAlias_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.allow_alias"
|
||||||
EnumOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated"
|
EnumOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated"
|
||||||
EnumOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.uninterpreted_option"
|
EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated_legacy_json_field_conflicts"
|
||||||
|
EnumOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.features"
|
||||||
|
EnumOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.EnumOptions.
|
// Field numbers for google.protobuf.EnumOptions.
|
||||||
const (
|
const (
|
||||||
EnumOptions_AllowAlias_field_number protoreflect.FieldNumber = 2
|
EnumOptions_AllowAlias_field_number protoreflect.FieldNumber = 2
|
||||||
EnumOptions_Deprecated_field_number protoreflect.FieldNumber = 3
|
EnumOptions_Deprecated_field_number protoreflect.FieldNumber = 3
|
||||||
EnumOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_number protoreflect.FieldNumber = 6
|
||||||
|
EnumOptions_Features_field_number protoreflect.FieldNumber = 7
|
||||||
|
EnumOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.EnumValueOptions.
|
// Names for google.protobuf.EnumValueOptions.
|
||||||
|
|
@ -615,15 +858,21 @@ const (
|
||||||
// Field names for google.protobuf.EnumValueOptions.
|
// Field names for google.protobuf.EnumValueOptions.
|
||||||
const (
|
const (
|
||||||
EnumValueOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
EnumValueOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
|
EnumValueOptions_Features_field_name protoreflect.Name = "features"
|
||||||
|
EnumValueOptions_DebugRedact_field_name protoreflect.Name = "debug_redact"
|
||||||
EnumValueOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
EnumValueOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
EnumValueOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.deprecated"
|
EnumValueOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.deprecated"
|
||||||
|
EnumValueOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.features"
|
||||||
|
EnumValueOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.debug_redact"
|
||||||
EnumValueOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.uninterpreted_option"
|
EnumValueOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.EnumValueOptions.
|
// Field numbers for google.protobuf.EnumValueOptions.
|
||||||
const (
|
const (
|
||||||
EnumValueOptions_Deprecated_field_number protoreflect.FieldNumber = 1
|
EnumValueOptions_Deprecated_field_number protoreflect.FieldNumber = 1
|
||||||
|
EnumValueOptions_Features_field_number protoreflect.FieldNumber = 2
|
||||||
|
EnumValueOptions_DebugRedact_field_number protoreflect.FieldNumber = 3
|
||||||
EnumValueOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
EnumValueOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -635,15 +884,18 @@ const (
|
||||||
|
|
||||||
// Field names for google.protobuf.ServiceOptions.
|
// Field names for google.protobuf.ServiceOptions.
|
||||||
const (
|
const (
|
||||||
|
ServiceOptions_Features_field_name protoreflect.Name = "features"
|
||||||
ServiceOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
ServiceOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
ServiceOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
ServiceOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
|
ServiceOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.features"
|
||||||
ServiceOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.deprecated"
|
ServiceOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.deprecated"
|
||||||
ServiceOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.uninterpreted_option"
|
ServiceOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.ServiceOptions.
|
// Field numbers for google.protobuf.ServiceOptions.
|
||||||
const (
|
const (
|
||||||
|
ServiceOptions_Features_field_number protoreflect.FieldNumber = 34
|
||||||
ServiceOptions_Deprecated_field_number protoreflect.FieldNumber = 33
|
ServiceOptions_Deprecated_field_number protoreflect.FieldNumber = 33
|
||||||
ServiceOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
ServiceOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
@ -658,10 +910,12 @@ const (
|
||||||
const (
|
const (
|
||||||
MethodOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
MethodOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
MethodOptions_IdempotencyLevel_field_name protoreflect.Name = "idempotency_level"
|
MethodOptions_IdempotencyLevel_field_name protoreflect.Name = "idempotency_level"
|
||||||
|
MethodOptions_Features_field_name protoreflect.Name = "features"
|
||||||
MethodOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
MethodOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
MethodOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.deprecated"
|
MethodOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.deprecated"
|
||||||
MethodOptions_IdempotencyLevel_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.idempotency_level"
|
MethodOptions_IdempotencyLevel_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.idempotency_level"
|
||||||
|
MethodOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.features"
|
||||||
MethodOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.uninterpreted_option"
|
MethodOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -669,6 +923,7 @@ const (
|
||||||
const (
|
const (
|
||||||
MethodOptions_Deprecated_field_number protoreflect.FieldNumber = 33
|
MethodOptions_Deprecated_field_number protoreflect.FieldNumber = 33
|
||||||
MethodOptions_IdempotencyLevel_field_number protoreflect.FieldNumber = 34
|
MethodOptions_IdempotencyLevel_field_number protoreflect.FieldNumber = 34
|
||||||
|
MethodOptions_Features_field_number protoreflect.FieldNumber = 35
|
||||||
MethodOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
MethodOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -678,6 +933,13 @@ const (
|
||||||
MethodOptions_IdempotencyLevel_enum_name = "IdempotencyLevel"
|
MethodOptions_IdempotencyLevel_enum_name = "IdempotencyLevel"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.MethodOptions.IdempotencyLevel.
|
||||||
|
const (
|
||||||
|
MethodOptions_IDEMPOTENCY_UNKNOWN_enum_value = 0
|
||||||
|
MethodOptions_NO_SIDE_EFFECTS_enum_value = 1
|
||||||
|
MethodOptions_IDEMPOTENT_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.UninterpretedOption.
|
// Names for google.protobuf.UninterpretedOption.
|
||||||
const (
|
const (
|
||||||
UninterpretedOption_message_name protoreflect.Name = "UninterpretedOption"
|
UninterpretedOption_message_name protoreflect.Name = "UninterpretedOption"
|
||||||
|
|
@ -735,6 +997,166 @@ const (
|
||||||
UninterpretedOption_NamePart_IsExtension_field_number protoreflect.FieldNumber = 2
|
UninterpretedOption_NamePart_IsExtension_field_number protoreflect.FieldNumber = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Names for google.protobuf.FeatureSet.
|
||||||
|
const (
|
||||||
|
FeatureSet_message_name protoreflect.Name = "FeatureSet"
|
||||||
|
FeatureSet_message_fullname protoreflect.FullName = "google.protobuf.FeatureSet"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field names for google.protobuf.FeatureSet.
|
||||||
|
const (
|
||||||
|
FeatureSet_FieldPresence_field_name protoreflect.Name = "field_presence"
|
||||||
|
FeatureSet_EnumType_field_name protoreflect.Name = "enum_type"
|
||||||
|
FeatureSet_RepeatedFieldEncoding_field_name protoreflect.Name = "repeated_field_encoding"
|
||||||
|
FeatureSet_Utf8Validation_field_name protoreflect.Name = "utf8_validation"
|
||||||
|
FeatureSet_MessageEncoding_field_name protoreflect.Name = "message_encoding"
|
||||||
|
FeatureSet_JsonFormat_field_name protoreflect.Name = "json_format"
|
||||||
|
|
||||||
|
FeatureSet_FieldPresence_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.field_presence"
|
||||||
|
FeatureSet_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enum_type"
|
||||||
|
FeatureSet_RepeatedFieldEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.repeated_field_encoding"
|
||||||
|
FeatureSet_Utf8Validation_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.utf8_validation"
|
||||||
|
FeatureSet_MessageEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.message_encoding"
|
||||||
|
FeatureSet_JsonFormat_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.json_format"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.FeatureSet.
|
||||||
|
const (
|
||||||
|
FeatureSet_FieldPresence_field_number protoreflect.FieldNumber = 1
|
||||||
|
FeatureSet_EnumType_field_number protoreflect.FieldNumber = 2
|
||||||
|
FeatureSet_RepeatedFieldEncoding_field_number protoreflect.FieldNumber = 3
|
||||||
|
FeatureSet_Utf8Validation_field_number protoreflect.FieldNumber = 4
|
||||||
|
FeatureSet_MessageEncoding_field_number protoreflect.FieldNumber = 5
|
||||||
|
FeatureSet_JsonFormat_field_number protoreflect.FieldNumber = 6
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FeatureSet.FieldPresence.
|
||||||
|
const (
|
||||||
|
FeatureSet_FieldPresence_enum_fullname = "google.protobuf.FeatureSet.FieldPresence"
|
||||||
|
FeatureSet_FieldPresence_enum_name = "FieldPresence"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FeatureSet.FieldPresence.
|
||||||
|
const (
|
||||||
|
FeatureSet_FIELD_PRESENCE_UNKNOWN_enum_value = 0
|
||||||
|
FeatureSet_EXPLICIT_enum_value = 1
|
||||||
|
FeatureSet_IMPLICIT_enum_value = 2
|
||||||
|
FeatureSet_LEGACY_REQUIRED_enum_value = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FeatureSet.EnumType.
|
||||||
|
const (
|
||||||
|
FeatureSet_EnumType_enum_fullname = "google.protobuf.FeatureSet.EnumType"
|
||||||
|
FeatureSet_EnumType_enum_name = "EnumType"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FeatureSet.EnumType.
|
||||||
|
const (
|
||||||
|
FeatureSet_ENUM_TYPE_UNKNOWN_enum_value = 0
|
||||||
|
FeatureSet_OPEN_enum_value = 1
|
||||||
|
FeatureSet_CLOSED_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FeatureSet.RepeatedFieldEncoding.
|
||||||
|
const (
|
||||||
|
FeatureSet_RepeatedFieldEncoding_enum_fullname = "google.protobuf.FeatureSet.RepeatedFieldEncoding"
|
||||||
|
FeatureSet_RepeatedFieldEncoding_enum_name = "RepeatedFieldEncoding"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FeatureSet.RepeatedFieldEncoding.
|
||||||
|
const (
|
||||||
|
FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN_enum_value = 0
|
||||||
|
FeatureSet_PACKED_enum_value = 1
|
||||||
|
FeatureSet_EXPANDED_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FeatureSet.Utf8Validation.
|
||||||
|
const (
|
||||||
|
FeatureSet_Utf8Validation_enum_fullname = "google.protobuf.FeatureSet.Utf8Validation"
|
||||||
|
FeatureSet_Utf8Validation_enum_name = "Utf8Validation"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FeatureSet.Utf8Validation.
|
||||||
|
const (
|
||||||
|
FeatureSet_UTF8_VALIDATION_UNKNOWN_enum_value = 0
|
||||||
|
FeatureSet_VERIFY_enum_value = 2
|
||||||
|
FeatureSet_NONE_enum_value = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FeatureSet.MessageEncoding.
|
||||||
|
const (
|
||||||
|
FeatureSet_MessageEncoding_enum_fullname = "google.protobuf.FeatureSet.MessageEncoding"
|
||||||
|
FeatureSet_MessageEncoding_enum_name = "MessageEncoding"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FeatureSet.MessageEncoding.
|
||||||
|
const (
|
||||||
|
FeatureSet_MESSAGE_ENCODING_UNKNOWN_enum_value = 0
|
||||||
|
FeatureSet_LENGTH_PREFIXED_enum_value = 1
|
||||||
|
FeatureSet_DELIMITED_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FeatureSet.JsonFormat.
|
||||||
|
const (
|
||||||
|
FeatureSet_JsonFormat_enum_fullname = "google.protobuf.FeatureSet.JsonFormat"
|
||||||
|
FeatureSet_JsonFormat_enum_name = "JsonFormat"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FeatureSet.JsonFormat.
|
||||||
|
const (
|
||||||
|
FeatureSet_JSON_FORMAT_UNKNOWN_enum_value = 0
|
||||||
|
FeatureSet_ALLOW_enum_value = 1
|
||||||
|
FeatureSet_LEGACY_BEST_EFFORT_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// Names for google.protobuf.FeatureSetDefaults.
|
||||||
|
const (
|
||||||
|
FeatureSetDefaults_message_name protoreflect.Name = "FeatureSetDefaults"
|
||||||
|
FeatureSetDefaults_message_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field names for google.protobuf.FeatureSetDefaults.
|
||||||
|
const (
|
||||||
|
FeatureSetDefaults_Defaults_field_name protoreflect.Name = "defaults"
|
||||||
|
FeatureSetDefaults_MinimumEdition_field_name protoreflect.Name = "minimum_edition"
|
||||||
|
FeatureSetDefaults_MaximumEdition_field_name protoreflect.Name = "maximum_edition"
|
||||||
|
|
||||||
|
FeatureSetDefaults_Defaults_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.defaults"
|
||||||
|
FeatureSetDefaults_MinimumEdition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.minimum_edition"
|
||||||
|
FeatureSetDefaults_MaximumEdition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.maximum_edition"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.FeatureSetDefaults.
|
||||||
|
const (
|
||||||
|
FeatureSetDefaults_Defaults_field_number protoreflect.FieldNumber = 1
|
||||||
|
FeatureSetDefaults_MinimumEdition_field_number protoreflect.FieldNumber = 4
|
||||||
|
FeatureSetDefaults_MaximumEdition_field_number protoreflect.FieldNumber = 5
|
||||||
|
)
|
||||||
|
|
||||||
|
// Names for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.
|
||||||
|
const (
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_message_name protoreflect.Name = "FeatureSetEditionDefault"
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_message_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field names for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.
|
||||||
|
const (
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_name protoreflect.Name = "edition"
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_OverridableFeatures_field_name protoreflect.Name = "overridable_features"
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_FixedFeatures_field_name protoreflect.Name = "fixed_features"
|
||||||
|
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition"
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_OverridableFeatures_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridable_features"
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_FixedFeatures_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.
|
||||||
|
const (
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_number protoreflect.FieldNumber = 3
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_OverridableFeatures_field_number protoreflect.FieldNumber = 4
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_FixedFeatures_field_number protoreflect.FieldNumber = 5
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.SourceCodeInfo.
|
// Names for google.protobuf.SourceCodeInfo.
|
||||||
const (
|
const (
|
||||||
SourceCodeInfo_message_name protoreflect.Name = "SourceCodeInfo"
|
SourceCodeInfo_message_name protoreflect.Name = "SourceCodeInfo"
|
||||||
|
|
@ -813,11 +1235,13 @@ const (
|
||||||
GeneratedCodeInfo_Annotation_SourceFile_field_name protoreflect.Name = "source_file"
|
GeneratedCodeInfo_Annotation_SourceFile_field_name protoreflect.Name = "source_file"
|
||||||
GeneratedCodeInfo_Annotation_Begin_field_name protoreflect.Name = "begin"
|
GeneratedCodeInfo_Annotation_Begin_field_name protoreflect.Name = "begin"
|
||||||
GeneratedCodeInfo_Annotation_End_field_name protoreflect.Name = "end"
|
GeneratedCodeInfo_Annotation_End_field_name protoreflect.Name = "end"
|
||||||
|
GeneratedCodeInfo_Annotation_Semantic_field_name protoreflect.Name = "semantic"
|
||||||
|
|
||||||
GeneratedCodeInfo_Annotation_Path_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.path"
|
GeneratedCodeInfo_Annotation_Path_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.path"
|
||||||
GeneratedCodeInfo_Annotation_SourceFile_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.source_file"
|
GeneratedCodeInfo_Annotation_SourceFile_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.source_file"
|
||||||
GeneratedCodeInfo_Annotation_Begin_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.begin"
|
GeneratedCodeInfo_Annotation_Begin_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.begin"
|
||||||
GeneratedCodeInfo_Annotation_End_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.end"
|
GeneratedCodeInfo_Annotation_End_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.end"
|
||||||
|
GeneratedCodeInfo_Annotation_Semantic_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.semantic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.GeneratedCodeInfo.Annotation.
|
// Field numbers for google.protobuf.GeneratedCodeInfo.Annotation.
|
||||||
|
|
@ -826,4 +1250,18 @@ const (
|
||||||
GeneratedCodeInfo_Annotation_SourceFile_field_number protoreflect.FieldNumber = 2
|
GeneratedCodeInfo_Annotation_SourceFile_field_number protoreflect.FieldNumber = 2
|
||||||
GeneratedCodeInfo_Annotation_Begin_field_number protoreflect.FieldNumber = 3
|
GeneratedCodeInfo_Annotation_Begin_field_number protoreflect.FieldNumber = 3
|
||||||
GeneratedCodeInfo_Annotation_End_field_number protoreflect.FieldNumber = 4
|
GeneratedCodeInfo_Annotation_End_field_number protoreflect.FieldNumber = 4
|
||||||
|
GeneratedCodeInfo_Annotation_Semantic_field_number protoreflect.FieldNumber = 5
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.GeneratedCodeInfo.Annotation.Semantic.
|
||||||
|
const (
|
||||||
|
GeneratedCodeInfo_Annotation_Semantic_enum_fullname = "google.protobuf.GeneratedCodeInfo.Annotation.Semantic"
|
||||||
|
GeneratedCodeInfo_Annotation_Semantic_enum_name = "Semantic"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.GeneratedCodeInfo.Annotation.Semantic.
|
||||||
|
const (
|
||||||
|
GeneratedCodeInfo_Annotation_NONE_enum_value = 0
|
||||||
|
GeneratedCodeInfo_Annotation_SET_enum_value = 1
|
||||||
|
GeneratedCodeInfo_Annotation_ALIAS_enum_value = 2
|
||||||
)
|
)
|
||||||
|
|
|
||||||
31
vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go
generated
vendored
Normal file
31
vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
// Code generated by generate-protos. DO NOT EDIT.
|
||||||
|
|
||||||
|
package genid
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
const File_google_protobuf_go_features_proto = "google/protobuf/go_features.proto"
|
||||||
|
|
||||||
|
// Names for google.protobuf.GoFeatures.
|
||||||
|
const (
|
||||||
|
GoFeatures_message_name protoreflect.Name = "GoFeatures"
|
||||||
|
GoFeatures_message_fullname protoreflect.FullName = "google.protobuf.GoFeatures"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field names for google.protobuf.GoFeatures.
|
||||||
|
const (
|
||||||
|
GoFeatures_LegacyUnmarshalJsonEnum_field_name protoreflect.Name = "legacy_unmarshal_json_enum"
|
||||||
|
|
||||||
|
GoFeatures_LegacyUnmarshalJsonEnum_field_fullname protoreflect.FullName = "google.protobuf.GoFeatures.legacy_unmarshal_json_enum"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.GoFeatures.
|
||||||
|
const (
|
||||||
|
GoFeatures_LegacyUnmarshalJsonEnum_field_number protoreflect.FieldNumber = 1
|
||||||
|
)
|
||||||
5
vendor/google.golang.org/protobuf/internal/genid/struct_gen.go
generated
vendored
5
vendor/google.golang.org/protobuf/internal/genid/struct_gen.go
generated
vendored
|
|
@ -18,6 +18,11 @@ const (
|
||||||
NullValue_enum_name = "NullValue"
|
NullValue_enum_name = "NullValue"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.NullValue.
|
||||||
|
const (
|
||||||
|
NullValue_NULL_VALUE_enum_value = 0
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.Struct.
|
// Names for google.protobuf.Struct.
|
||||||
const (
|
const (
|
||||||
Struct_message_name protoreflect.Name = "Struct"
|
Struct_message_name protoreflect.Name = "Struct"
|
||||||
|
|
|
||||||
44
vendor/google.golang.org/protobuf/internal/genid/type_gen.go
generated
vendored
44
vendor/google.golang.org/protobuf/internal/genid/type_gen.go
generated
vendored
|
|
@ -18,6 +18,13 @@ const (
|
||||||
Syntax_enum_name = "Syntax"
|
Syntax_enum_name = "Syntax"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.Syntax.
|
||||||
|
const (
|
||||||
|
Syntax_SYNTAX_PROTO2_enum_value = 0
|
||||||
|
Syntax_SYNTAX_PROTO3_enum_value = 1
|
||||||
|
Syntax_SYNTAX_EDITIONS_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.Type.
|
// Names for google.protobuf.Type.
|
||||||
const (
|
const (
|
||||||
Type_message_name protoreflect.Name = "Type"
|
Type_message_name protoreflect.Name = "Type"
|
||||||
|
|
@ -32,6 +39,7 @@ const (
|
||||||
Type_Options_field_name protoreflect.Name = "options"
|
Type_Options_field_name protoreflect.Name = "options"
|
||||||
Type_SourceContext_field_name protoreflect.Name = "source_context"
|
Type_SourceContext_field_name protoreflect.Name = "source_context"
|
||||||
Type_Syntax_field_name protoreflect.Name = "syntax"
|
Type_Syntax_field_name protoreflect.Name = "syntax"
|
||||||
|
Type_Edition_field_name protoreflect.Name = "edition"
|
||||||
|
|
||||||
Type_Name_field_fullname protoreflect.FullName = "google.protobuf.Type.name"
|
Type_Name_field_fullname protoreflect.FullName = "google.protobuf.Type.name"
|
||||||
Type_Fields_field_fullname protoreflect.FullName = "google.protobuf.Type.fields"
|
Type_Fields_field_fullname protoreflect.FullName = "google.protobuf.Type.fields"
|
||||||
|
|
@ -39,6 +47,7 @@ const (
|
||||||
Type_Options_field_fullname protoreflect.FullName = "google.protobuf.Type.options"
|
Type_Options_field_fullname protoreflect.FullName = "google.protobuf.Type.options"
|
||||||
Type_SourceContext_field_fullname protoreflect.FullName = "google.protobuf.Type.source_context"
|
Type_SourceContext_field_fullname protoreflect.FullName = "google.protobuf.Type.source_context"
|
||||||
Type_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Type.syntax"
|
Type_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Type.syntax"
|
||||||
|
Type_Edition_field_fullname protoreflect.FullName = "google.protobuf.Type.edition"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.Type.
|
// Field numbers for google.protobuf.Type.
|
||||||
|
|
@ -49,6 +58,7 @@ const (
|
||||||
Type_Options_field_number protoreflect.FieldNumber = 4
|
Type_Options_field_number protoreflect.FieldNumber = 4
|
||||||
Type_SourceContext_field_number protoreflect.FieldNumber = 5
|
Type_SourceContext_field_number protoreflect.FieldNumber = 5
|
||||||
Type_Syntax_field_number protoreflect.FieldNumber = 6
|
Type_Syntax_field_number protoreflect.FieldNumber = 6
|
||||||
|
Type_Edition_field_number protoreflect.FieldNumber = 7
|
||||||
)
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.Field.
|
// Names for google.protobuf.Field.
|
||||||
|
|
@ -102,12 +112,43 @@ const (
|
||||||
Field_Kind_enum_name = "Kind"
|
Field_Kind_enum_name = "Kind"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.Field.Kind.
|
||||||
|
const (
|
||||||
|
Field_TYPE_UNKNOWN_enum_value = 0
|
||||||
|
Field_TYPE_DOUBLE_enum_value = 1
|
||||||
|
Field_TYPE_FLOAT_enum_value = 2
|
||||||
|
Field_TYPE_INT64_enum_value = 3
|
||||||
|
Field_TYPE_UINT64_enum_value = 4
|
||||||
|
Field_TYPE_INT32_enum_value = 5
|
||||||
|
Field_TYPE_FIXED64_enum_value = 6
|
||||||
|
Field_TYPE_FIXED32_enum_value = 7
|
||||||
|
Field_TYPE_BOOL_enum_value = 8
|
||||||
|
Field_TYPE_STRING_enum_value = 9
|
||||||
|
Field_TYPE_GROUP_enum_value = 10
|
||||||
|
Field_TYPE_MESSAGE_enum_value = 11
|
||||||
|
Field_TYPE_BYTES_enum_value = 12
|
||||||
|
Field_TYPE_UINT32_enum_value = 13
|
||||||
|
Field_TYPE_ENUM_enum_value = 14
|
||||||
|
Field_TYPE_SFIXED32_enum_value = 15
|
||||||
|
Field_TYPE_SFIXED64_enum_value = 16
|
||||||
|
Field_TYPE_SINT32_enum_value = 17
|
||||||
|
Field_TYPE_SINT64_enum_value = 18
|
||||||
|
)
|
||||||
|
|
||||||
// Full and short names for google.protobuf.Field.Cardinality.
|
// Full and short names for google.protobuf.Field.Cardinality.
|
||||||
const (
|
const (
|
||||||
Field_Cardinality_enum_fullname = "google.protobuf.Field.Cardinality"
|
Field_Cardinality_enum_fullname = "google.protobuf.Field.Cardinality"
|
||||||
Field_Cardinality_enum_name = "Cardinality"
|
Field_Cardinality_enum_name = "Cardinality"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.Field.Cardinality.
|
||||||
|
const (
|
||||||
|
Field_CARDINALITY_UNKNOWN_enum_value = 0
|
||||||
|
Field_CARDINALITY_OPTIONAL_enum_value = 1
|
||||||
|
Field_CARDINALITY_REQUIRED_enum_value = 2
|
||||||
|
Field_CARDINALITY_REPEATED_enum_value = 3
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.Enum.
|
// Names for google.protobuf.Enum.
|
||||||
const (
|
const (
|
||||||
Enum_message_name protoreflect.Name = "Enum"
|
Enum_message_name protoreflect.Name = "Enum"
|
||||||
|
|
@ -121,12 +162,14 @@ const (
|
||||||
Enum_Options_field_name protoreflect.Name = "options"
|
Enum_Options_field_name protoreflect.Name = "options"
|
||||||
Enum_SourceContext_field_name protoreflect.Name = "source_context"
|
Enum_SourceContext_field_name protoreflect.Name = "source_context"
|
||||||
Enum_Syntax_field_name protoreflect.Name = "syntax"
|
Enum_Syntax_field_name protoreflect.Name = "syntax"
|
||||||
|
Enum_Edition_field_name protoreflect.Name = "edition"
|
||||||
|
|
||||||
Enum_Name_field_fullname protoreflect.FullName = "google.protobuf.Enum.name"
|
Enum_Name_field_fullname protoreflect.FullName = "google.protobuf.Enum.name"
|
||||||
Enum_Enumvalue_field_fullname protoreflect.FullName = "google.protobuf.Enum.enumvalue"
|
Enum_Enumvalue_field_fullname protoreflect.FullName = "google.protobuf.Enum.enumvalue"
|
||||||
Enum_Options_field_fullname protoreflect.FullName = "google.protobuf.Enum.options"
|
Enum_Options_field_fullname protoreflect.FullName = "google.protobuf.Enum.options"
|
||||||
Enum_SourceContext_field_fullname protoreflect.FullName = "google.protobuf.Enum.source_context"
|
Enum_SourceContext_field_fullname protoreflect.FullName = "google.protobuf.Enum.source_context"
|
||||||
Enum_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Enum.syntax"
|
Enum_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Enum.syntax"
|
||||||
|
Enum_Edition_field_fullname protoreflect.FullName = "google.protobuf.Enum.edition"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.Enum.
|
// Field numbers for google.protobuf.Enum.
|
||||||
|
|
@ -136,6 +179,7 @@ const (
|
||||||
Enum_Options_field_number protoreflect.FieldNumber = 3
|
Enum_Options_field_number protoreflect.FieldNumber = 3
|
||||||
Enum_SourceContext_field_number protoreflect.FieldNumber = 4
|
Enum_SourceContext_field_number protoreflect.FieldNumber = 4
|
||||||
Enum_Syntax_field_number protoreflect.FieldNumber = 5
|
Enum_Syntax_field_number protoreflect.FieldNumber = 5
|
||||||
|
Enum_Edition_field_number protoreflect.FieldNumber = 6
|
||||||
)
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.EnumValue.
|
// Names for google.protobuf.EnumValue.
|
||||||
|
|
|
||||||
42
vendor/google.golang.org/protobuf/internal/impl/api_export.go
generated
vendored
42
vendor/google.golang.org/protobuf/internal/impl/api_export.go
generated
vendored
|
|
@ -12,8 +12,8 @@ import (
|
||||||
"google.golang.org/protobuf/encoding/prototext"
|
"google.golang.org/protobuf/encoding/prototext"
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Export is a zero-length named type that exists only to export a set of
|
// Export is a zero-length named type that exists only to export a set of
|
||||||
|
|
@ -32,11 +32,11 @@ type enum = interface{}
|
||||||
|
|
||||||
// EnumOf returns the protoreflect.Enum interface over e.
|
// EnumOf returns the protoreflect.Enum interface over e.
|
||||||
// It returns nil if e is nil.
|
// It returns nil if e is nil.
|
||||||
func (Export) EnumOf(e enum) pref.Enum {
|
func (Export) EnumOf(e enum) protoreflect.Enum {
|
||||||
switch e := e.(type) {
|
switch e := e.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
return nil
|
return nil
|
||||||
case pref.Enum:
|
case protoreflect.Enum:
|
||||||
return e
|
return e
|
||||||
default:
|
default:
|
||||||
return legacyWrapEnum(reflect.ValueOf(e))
|
return legacyWrapEnum(reflect.ValueOf(e))
|
||||||
|
|
@ -45,11 +45,11 @@ func (Export) EnumOf(e enum) pref.Enum {
|
||||||
|
|
||||||
// EnumDescriptorOf returns the protoreflect.EnumDescriptor for e.
|
// EnumDescriptorOf returns the protoreflect.EnumDescriptor for e.
|
||||||
// It returns nil if e is nil.
|
// It returns nil if e is nil.
|
||||||
func (Export) EnumDescriptorOf(e enum) pref.EnumDescriptor {
|
func (Export) EnumDescriptorOf(e enum) protoreflect.EnumDescriptor {
|
||||||
switch e := e.(type) {
|
switch e := e.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
return nil
|
return nil
|
||||||
case pref.Enum:
|
case protoreflect.Enum:
|
||||||
return e.Descriptor()
|
return e.Descriptor()
|
||||||
default:
|
default:
|
||||||
return LegacyLoadEnumDesc(reflect.TypeOf(e))
|
return LegacyLoadEnumDesc(reflect.TypeOf(e))
|
||||||
|
|
@ -58,11 +58,11 @@ func (Export) EnumDescriptorOf(e enum) pref.EnumDescriptor {
|
||||||
|
|
||||||
// EnumTypeOf returns the protoreflect.EnumType for e.
|
// EnumTypeOf returns the protoreflect.EnumType for e.
|
||||||
// It returns nil if e is nil.
|
// It returns nil if e is nil.
|
||||||
func (Export) EnumTypeOf(e enum) pref.EnumType {
|
func (Export) EnumTypeOf(e enum) protoreflect.EnumType {
|
||||||
switch e := e.(type) {
|
switch e := e.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
return nil
|
return nil
|
||||||
case pref.Enum:
|
case protoreflect.Enum:
|
||||||
return e.Type()
|
return e.Type()
|
||||||
default:
|
default:
|
||||||
return legacyLoadEnumType(reflect.TypeOf(e))
|
return legacyLoadEnumType(reflect.TypeOf(e))
|
||||||
|
|
@ -71,7 +71,7 @@ func (Export) EnumTypeOf(e enum) pref.EnumType {
|
||||||
|
|
||||||
// EnumStringOf returns the enum value as a string, either as the name if
|
// EnumStringOf returns the enum value as a string, either as the name if
|
||||||
// the number is resolvable, or the number formatted as a string.
|
// the number is resolvable, or the number formatted as a string.
|
||||||
func (Export) EnumStringOf(ed pref.EnumDescriptor, n pref.EnumNumber) string {
|
func (Export) EnumStringOf(ed protoreflect.EnumDescriptor, n protoreflect.EnumNumber) string {
|
||||||
ev := ed.Values().ByNumber(n)
|
ev := ed.Values().ByNumber(n)
|
||||||
if ev != nil {
|
if ev != nil {
|
||||||
return string(ev.Name())
|
return string(ev.Name())
|
||||||
|
|
@ -84,7 +84,7 @@ func (Export) EnumStringOf(ed pref.EnumDescriptor, n pref.EnumNumber) string {
|
||||||
type message = interface{}
|
type message = interface{}
|
||||||
|
|
||||||
// legacyMessageWrapper wraps a v2 message as a v1 message.
|
// legacyMessageWrapper wraps a v2 message as a v1 message.
|
||||||
type legacyMessageWrapper struct{ m pref.ProtoMessage }
|
type legacyMessageWrapper struct{ m protoreflect.ProtoMessage }
|
||||||
|
|
||||||
func (m legacyMessageWrapper) Reset() { proto.Reset(m.m) }
|
func (m legacyMessageWrapper) Reset() { proto.Reset(m.m) }
|
||||||
func (m legacyMessageWrapper) String() string { return Export{}.MessageStringOf(m.m) }
|
func (m legacyMessageWrapper) String() string { return Export{}.MessageStringOf(m.m) }
|
||||||
|
|
@ -92,30 +92,30 @@ func (m legacyMessageWrapper) ProtoMessage() {}
|
||||||
|
|
||||||
// ProtoMessageV1Of converts either a v1 or v2 message to a v1 message.
|
// ProtoMessageV1Of converts either a v1 or v2 message to a v1 message.
|
||||||
// It returns nil if m is nil.
|
// It returns nil if m is nil.
|
||||||
func (Export) ProtoMessageV1Of(m message) piface.MessageV1 {
|
func (Export) ProtoMessageV1Of(m message) protoiface.MessageV1 {
|
||||||
switch mv := m.(type) {
|
switch mv := m.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
return nil
|
return nil
|
||||||
case piface.MessageV1:
|
case protoiface.MessageV1:
|
||||||
return mv
|
return mv
|
||||||
case unwrapper:
|
case unwrapper:
|
||||||
return Export{}.ProtoMessageV1Of(mv.protoUnwrap())
|
return Export{}.ProtoMessageV1Of(mv.protoUnwrap())
|
||||||
case pref.ProtoMessage:
|
case protoreflect.ProtoMessage:
|
||||||
return legacyMessageWrapper{mv}
|
return legacyMessageWrapper{mv}
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m))
|
panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Export) protoMessageV2Of(m message) pref.ProtoMessage {
|
func (Export) protoMessageV2Of(m message) protoreflect.ProtoMessage {
|
||||||
switch mv := m.(type) {
|
switch mv := m.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
return nil
|
return nil
|
||||||
case pref.ProtoMessage:
|
case protoreflect.ProtoMessage:
|
||||||
return mv
|
return mv
|
||||||
case legacyMessageWrapper:
|
case legacyMessageWrapper:
|
||||||
return mv.m
|
return mv.m
|
||||||
case piface.MessageV1:
|
case protoiface.MessageV1:
|
||||||
return nil
|
return nil
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m))
|
panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m))
|
||||||
|
|
@ -124,7 +124,7 @@ func (Export) protoMessageV2Of(m message) pref.ProtoMessage {
|
||||||
|
|
||||||
// ProtoMessageV2Of converts either a v1 or v2 message to a v2 message.
|
// ProtoMessageV2Of converts either a v1 or v2 message to a v2 message.
|
||||||
// It returns nil if m is nil.
|
// It returns nil if m is nil.
|
||||||
func (Export) ProtoMessageV2Of(m message) pref.ProtoMessage {
|
func (Export) ProtoMessageV2Of(m message) protoreflect.ProtoMessage {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -136,7 +136,7 @@ func (Export) ProtoMessageV2Of(m message) pref.ProtoMessage {
|
||||||
|
|
||||||
// MessageOf returns the protoreflect.Message interface over m.
|
// MessageOf returns the protoreflect.Message interface over m.
|
||||||
// It returns nil if m is nil.
|
// It returns nil if m is nil.
|
||||||
func (Export) MessageOf(m message) pref.Message {
|
func (Export) MessageOf(m message) protoreflect.Message {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -148,7 +148,7 @@ func (Export) MessageOf(m message) pref.Message {
|
||||||
|
|
||||||
// MessageDescriptorOf returns the protoreflect.MessageDescriptor for m.
|
// MessageDescriptorOf returns the protoreflect.MessageDescriptor for m.
|
||||||
// It returns nil if m is nil.
|
// It returns nil if m is nil.
|
||||||
func (Export) MessageDescriptorOf(m message) pref.MessageDescriptor {
|
func (Export) MessageDescriptorOf(m message) protoreflect.MessageDescriptor {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -160,7 +160,7 @@ func (Export) MessageDescriptorOf(m message) pref.MessageDescriptor {
|
||||||
|
|
||||||
// MessageTypeOf returns the protoreflect.MessageType for m.
|
// MessageTypeOf returns the protoreflect.MessageType for m.
|
||||||
// It returns nil if m is nil.
|
// It returns nil if m is nil.
|
||||||
func (Export) MessageTypeOf(m message) pref.MessageType {
|
func (Export) MessageTypeOf(m message) protoreflect.MessageType {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -172,6 +172,6 @@ func (Export) MessageTypeOf(m message) pref.MessageType {
|
||||||
|
|
||||||
// MessageStringOf returns the message value as a string,
|
// MessageStringOf returns the message value as a string,
|
||||||
// which is the message serialized in the protobuf text format.
|
// which is the message serialized in the protobuf text format.
|
||||||
func (Export) MessageStringOf(m pref.ProtoMessage) string {
|
func (Export) MessageStringOf(m protoreflect.ProtoMessage) string {
|
||||||
return prototext.MarshalOptions{Multiline: false}.Format(m)
|
return prototext.MarshalOptions{Multiline: false}.Format(m)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
vendor/google.golang.org/protobuf/internal/impl/checkinit.go
generated
vendored
12
vendor/google.golang.org/protobuf/internal/impl/checkinit.go
generated
vendored
|
|
@ -8,18 +8,18 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (mi *MessageInfo) checkInitialized(in piface.CheckInitializedInput) (piface.CheckInitializedOutput, error) {
|
func (mi *MessageInfo) checkInitialized(in protoiface.CheckInitializedInput) (protoiface.CheckInitializedOutput, error) {
|
||||||
var p pointer
|
var p pointer
|
||||||
if ms, ok := in.Message.(*messageState); ok {
|
if ms, ok := in.Message.(*messageState); ok {
|
||||||
p = ms.pointer()
|
p = ms.pointer()
|
||||||
} else {
|
} else {
|
||||||
p = in.Message.(*messageReflectWrapper).pointer()
|
p = in.Message.(*messageReflectWrapper).pointer()
|
||||||
}
|
}
|
||||||
return piface.CheckInitializedOutput{}, mi.checkInitializedPointer(p)
|
return protoiface.CheckInitializedOutput{}, mi.checkInitializedPointer(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mi *MessageInfo) checkInitializedPointer(p pointer) error {
|
func (mi *MessageInfo) checkInitializedPointer(p pointer) error {
|
||||||
|
|
@ -90,7 +90,7 @@ var (
|
||||||
// needsInitCheck reports whether a message needs to be checked for partial initialization.
|
// needsInitCheck reports whether a message needs to be checked for partial initialization.
|
||||||
//
|
//
|
||||||
// It returns true if the message transitively includes any required or extension fields.
|
// It returns true if the message transitively includes any required or extension fields.
|
||||||
func needsInitCheck(md pref.MessageDescriptor) bool {
|
func needsInitCheck(md protoreflect.MessageDescriptor) bool {
|
||||||
if v, ok := needsInitCheckMap.Load(md); ok {
|
if v, ok := needsInitCheckMap.Load(md); ok {
|
||||||
if has, ok := v.(bool); ok {
|
if has, ok := v.(bool); ok {
|
||||||
return has
|
return has
|
||||||
|
|
@ -101,7 +101,7 @@ func needsInitCheck(md pref.MessageDescriptor) bool {
|
||||||
return needsInitCheckLocked(md)
|
return needsInitCheckLocked(md)
|
||||||
}
|
}
|
||||||
|
|
||||||
func needsInitCheckLocked(md pref.MessageDescriptor) (has bool) {
|
func needsInitCheckLocked(md protoreflect.MessageDescriptor) (has bool) {
|
||||||
if v, ok := needsInitCheckMap.Load(md); ok {
|
if v, ok := needsInitCheckMap.Load(md); ok {
|
||||||
// If has is true, we've previously determined that this message
|
// If has is true, we've previously determined that this message
|
||||||
// needs init checks.
|
// needs init checks.
|
||||||
|
|
|
||||||
56
vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
generated
vendored
56
vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
generated
vendored
|
|
@ -10,7 +10,7 @@ import (
|
||||||
|
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type extensionFieldInfo struct {
|
type extensionFieldInfo struct {
|
||||||
|
|
@ -21,29 +21,21 @@ type extensionFieldInfo struct {
|
||||||
validation validationInfo
|
validation validationInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
var legacyExtensionFieldInfoCache sync.Map // map[protoreflect.ExtensionType]*extensionFieldInfo
|
func getExtensionFieldInfo(xt protoreflect.ExtensionType) *extensionFieldInfo {
|
||||||
|
|
||||||
func getExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {
|
|
||||||
if xi, ok := xt.(*ExtensionInfo); ok {
|
if xi, ok := xt.(*ExtensionInfo); ok {
|
||||||
xi.lazyInit()
|
xi.lazyInit()
|
||||||
return xi.info
|
return xi.info
|
||||||
}
|
}
|
||||||
return legacyLoadExtensionFieldInfo(xt)
|
// Ideally we'd cache the resulting *extensionFieldInfo so we don't have to
|
||||||
|
// recompute this metadata repeatedly. But without support for something like
|
||||||
|
// weak references, such a cache would pin temporary values (like dynamic
|
||||||
|
// extension types, constructed for the duration of a user request) to the
|
||||||
|
// heap forever, causing memory usage of the cache to grow unbounded.
|
||||||
|
// See discussion in https://github.com/golang/protobuf/issues/1521.
|
||||||
|
return makeExtensionFieldInfo(xt.TypeDescriptor())
|
||||||
}
|
}
|
||||||
|
|
||||||
// legacyLoadExtensionFieldInfo dynamically loads a *ExtensionInfo for xt.
|
func makeExtensionFieldInfo(xd protoreflect.ExtensionDescriptor) *extensionFieldInfo {
|
||||||
func legacyLoadExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {
|
|
||||||
if xi, ok := legacyExtensionFieldInfoCache.Load(xt); ok {
|
|
||||||
return xi.(*extensionFieldInfo)
|
|
||||||
}
|
|
||||||
e := makeExtensionFieldInfo(xt.TypeDescriptor())
|
|
||||||
if e, ok := legacyMessageTypeCache.LoadOrStore(xt, e); ok {
|
|
||||||
return e.(*extensionFieldInfo)
|
|
||||||
}
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
|
|
||||||
func makeExtensionFieldInfo(xd pref.ExtensionDescriptor) *extensionFieldInfo {
|
|
||||||
var wiretag uint64
|
var wiretag uint64
|
||||||
if !xd.IsPacked() {
|
if !xd.IsPacked() {
|
||||||
wiretag = protowire.EncodeTag(xd.Number(), wireTypes[xd.Kind()])
|
wiretag = protowire.EncodeTag(xd.Number(), wireTypes[xd.Kind()])
|
||||||
|
|
@ -59,10 +51,10 @@ func makeExtensionFieldInfo(xd pref.ExtensionDescriptor) *extensionFieldInfo {
|
||||||
// This is true for composite types, where we pass in a message, list, or map to fill in,
|
// This is true for composite types, where we pass in a message, list, or map to fill in,
|
||||||
// and for enums, where we pass in a prototype value to specify the concrete enum type.
|
// and for enums, where we pass in a prototype value to specify the concrete enum type.
|
||||||
switch xd.Kind() {
|
switch xd.Kind() {
|
||||||
case pref.MessageKind, pref.GroupKind, pref.EnumKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind, protoreflect.EnumKind:
|
||||||
e.unmarshalNeedsValue = true
|
e.unmarshalNeedsValue = true
|
||||||
default:
|
default:
|
||||||
if xd.Cardinality() == pref.Repeated {
|
if xd.Cardinality() == protoreflect.Repeated {
|
||||||
e.unmarshalNeedsValue = true
|
e.unmarshalNeedsValue = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -73,21 +65,21 @@ type lazyExtensionValue struct {
|
||||||
atomicOnce uint32 // atomically set if value is valid
|
atomicOnce uint32 // atomically set if value is valid
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
xi *extensionFieldInfo
|
xi *extensionFieldInfo
|
||||||
value pref.Value
|
value protoreflect.Value
|
||||||
b []byte
|
b []byte
|
||||||
fn func() pref.Value
|
fn func() protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
type ExtensionField struct {
|
type ExtensionField struct {
|
||||||
typ pref.ExtensionType
|
typ protoreflect.ExtensionType
|
||||||
|
|
||||||
// value is either the value of GetValue,
|
// value is either the value of GetValue,
|
||||||
// or a *lazyExtensionValue that then returns the value of GetValue.
|
// or a *lazyExtensionValue that then returns the value of GetValue.
|
||||||
value pref.Value
|
value protoreflect.Value
|
||||||
lazy *lazyExtensionValue
|
lazy *lazyExtensionValue
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *ExtensionField) appendLazyBytes(xt pref.ExtensionType, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, b []byte) {
|
func (f *ExtensionField) appendLazyBytes(xt protoreflect.ExtensionType, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, b []byte) {
|
||||||
if f.lazy == nil {
|
if f.lazy == nil {
|
||||||
f.lazy = &lazyExtensionValue{xi: xi}
|
f.lazy = &lazyExtensionValue{xi: xi}
|
||||||
}
|
}
|
||||||
|
|
@ -97,7 +89,7 @@ func (f *ExtensionField) appendLazyBytes(xt pref.ExtensionType, xi *extensionFie
|
||||||
f.lazy.b = append(f.lazy.b, b...)
|
f.lazy.b = append(f.lazy.b, b...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *ExtensionField) canLazy(xt pref.ExtensionType) bool {
|
func (f *ExtensionField) canLazy(xt protoreflect.ExtensionType) bool {
|
||||||
if f.typ == nil {
|
if f.typ == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -154,7 +146,7 @@ func (f *ExtensionField) lazyInit() {
|
||||||
|
|
||||||
// Set sets the type and value of the extension field.
|
// Set sets the type and value of the extension field.
|
||||||
// This must not be called concurrently.
|
// This must not be called concurrently.
|
||||||
func (f *ExtensionField) Set(t pref.ExtensionType, v pref.Value) {
|
func (f *ExtensionField) Set(t protoreflect.ExtensionType, v protoreflect.Value) {
|
||||||
f.typ = t
|
f.typ = t
|
||||||
f.value = v
|
f.value = v
|
||||||
f.lazy = nil
|
f.lazy = nil
|
||||||
|
|
@ -162,14 +154,14 @@ func (f *ExtensionField) Set(t pref.ExtensionType, v pref.Value) {
|
||||||
|
|
||||||
// SetLazy sets the type and a value that is to be lazily evaluated upon first use.
|
// SetLazy sets the type and a value that is to be lazily evaluated upon first use.
|
||||||
// This must not be called concurrently.
|
// This must not be called concurrently.
|
||||||
func (f *ExtensionField) SetLazy(t pref.ExtensionType, fn func() pref.Value) {
|
func (f *ExtensionField) SetLazy(t protoreflect.ExtensionType, fn func() protoreflect.Value) {
|
||||||
f.typ = t
|
f.typ = t
|
||||||
f.lazy = &lazyExtensionValue{fn: fn}
|
f.lazy = &lazyExtensionValue{fn: fn}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Value returns the value of the extension field.
|
// Value returns the value of the extension field.
|
||||||
// This may be called concurrently.
|
// This may be called concurrently.
|
||||||
func (f *ExtensionField) Value() pref.Value {
|
func (f *ExtensionField) Value() protoreflect.Value {
|
||||||
if f.lazy != nil {
|
if f.lazy != nil {
|
||||||
if atomic.LoadUint32(&f.lazy.atomicOnce) == 0 {
|
if atomic.LoadUint32(&f.lazy.atomicOnce) == 0 {
|
||||||
f.lazyInit()
|
f.lazyInit()
|
||||||
|
|
@ -181,7 +173,7 @@ func (f *ExtensionField) Value() pref.Value {
|
||||||
|
|
||||||
// Type returns the type of the extension field.
|
// Type returns the type of the extension field.
|
||||||
// This may be called concurrently.
|
// This may be called concurrently.
|
||||||
func (f ExtensionField) Type() pref.ExtensionType {
|
func (f ExtensionField) Type() protoreflect.ExtensionType {
|
||||||
return f.typ
|
return f.typ
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,7 +185,7 @@ func (f ExtensionField) IsSet() bool {
|
||||||
|
|
||||||
// IsLazy reports whether a field is lazily encoded.
|
// IsLazy reports whether a field is lazily encoded.
|
||||||
// It is exported for testing.
|
// It is exported for testing.
|
||||||
func IsLazy(m pref.Message, fd pref.FieldDescriptor) bool {
|
func IsLazy(m protoreflect.Message, fd protoreflect.FieldDescriptor) bool {
|
||||||
var mi *MessageInfo
|
var mi *MessageInfo
|
||||||
var p pointer
|
var p pointer
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
|
|
@ -206,7 +198,7 @@ func IsLazy(m pref.Message, fd pref.FieldDescriptor) bool {
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
xd, ok := fd.(pref.ExtensionTypeDescriptor)
|
xd, ok := fd.(protoreflect.ExtensionTypeDescriptor)
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
154
vendor/google.golang.org/protobuf/internal/impl/codec_field.go
generated
vendored
154
vendor/google.golang.org/protobuf/internal/impl/codec_field.go
generated
vendored
|
|
@ -12,9 +12,9 @@ import (
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
type errInvalidUTF8 struct{}
|
type errInvalidUTF8 struct{}
|
||||||
|
|
@ -30,7 +30,7 @@ func (errInvalidUTF8) Unwrap() error { return errors.Error }
|
||||||
// to the appropriate field-specific function as necessary.
|
// to the appropriate field-specific function as necessary.
|
||||||
//
|
//
|
||||||
// The unmarshal function is set on each field individually as usual.
|
// The unmarshal function is set on each field individually as usual.
|
||||||
func (mi *MessageInfo) initOneofFieldCoders(od pref.OneofDescriptor, si structInfo) {
|
func (mi *MessageInfo) initOneofFieldCoders(od protoreflect.OneofDescriptor, si structInfo) {
|
||||||
fs := si.oneofsByName[od.Name()]
|
fs := si.oneofsByName[od.Name()]
|
||||||
ft := fs.Type
|
ft := fs.Type
|
||||||
oneofFields := make(map[reflect.Type]*coderFieldInfo)
|
oneofFields := make(map[reflect.Type]*coderFieldInfo)
|
||||||
|
|
@ -118,13 +118,13 @@ func (mi *MessageInfo) initOneofFieldCoders(od pref.OneofDescriptor, si structIn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeWeakMessageFieldCoder(fd pref.FieldDescriptor) pointerCoderFuncs {
|
func makeWeakMessageFieldCoder(fd protoreflect.FieldDescriptor) pointerCoderFuncs {
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
var messageType pref.MessageType
|
var messageType protoreflect.MessageType
|
||||||
lazyInit := func() {
|
lazyInit := func() {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
messageName := fd.Message().FullName()
|
messageName := fd.Message().FullName()
|
||||||
messageType, _ = preg.GlobalTypes.FindMessageByName(messageName)
|
messageType, _ = protoregistry.GlobalTypes.FindMessageByName(messageName)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,7 +190,7 @@ func makeWeakMessageFieldCoder(fd pref.FieldDescriptor) pointerCoderFuncs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeMessageFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
func makeMessageFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||||
if mi := getMessageInfo(ft); mi != nil {
|
if mi := getMessageInfo(ft); mi != nil {
|
||||||
funcs := pointerCoderFuncs{
|
funcs := pointerCoderFuncs{
|
||||||
size: sizeMessageInfo,
|
size: sizeMessageInfo,
|
||||||
|
|
@ -233,9 +233,15 @@ func sizeMessageInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendMessageInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
|
func appendMessageInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
|
||||||
|
calculatedSize := f.mi.sizePointer(p.Elem(), opts)
|
||||||
b = protowire.AppendVarint(b, f.wiretag)
|
b = protowire.AppendVarint(b, f.wiretag)
|
||||||
b = protowire.AppendVarint(b, uint64(f.mi.sizePointer(p.Elem(), opts)))
|
b = protowire.AppendVarint(b, uint64(calculatedSize))
|
||||||
return f.mi.marshalAppendPointer(b, p.Elem(), opts)
|
before := len(b)
|
||||||
|
b, err := f.mi.marshalAppendPointer(b, p.Elem(), opts)
|
||||||
|
if measuredSize := len(b) - before; calculatedSize != measuredSize && err == nil {
|
||||||
|
return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize)
|
||||||
|
}
|
||||||
|
return b, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func consumeMessageInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeMessageInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
|
|
@ -262,14 +268,21 @@ func isInitMessageInfo(p pointer, f *coderFieldInfo) error {
|
||||||
return f.mi.checkInitializedPointer(p.Elem())
|
return f.mi.checkInitializedPointer(p.Elem())
|
||||||
}
|
}
|
||||||
|
|
||||||
func sizeMessage(m proto.Message, tagsize int, _ marshalOptions) int {
|
func sizeMessage(m proto.Message, tagsize int, opts marshalOptions) int {
|
||||||
return protowire.SizeBytes(proto.Size(m)) + tagsize
|
return protowire.SizeBytes(opts.Options().Size(m)) + tagsize
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendMessage(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
func appendMessage(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||||
|
mopts := opts.Options()
|
||||||
|
calculatedSize := mopts.Size(m)
|
||||||
b = protowire.AppendVarint(b, wiretag)
|
b = protowire.AppendVarint(b, wiretag)
|
||||||
b = protowire.AppendVarint(b, uint64(proto.Size(m)))
|
b = protowire.AppendVarint(b, uint64(calculatedSize))
|
||||||
return opts.Options().MarshalAppend(b, m)
|
before := len(b)
|
||||||
|
b, err := mopts.MarshalAppend(b, m)
|
||||||
|
if measuredSize := len(b) - before; calculatedSize != measuredSize && err == nil {
|
||||||
|
return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize)
|
||||||
|
}
|
||||||
|
return b, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
|
|
@ -280,7 +293,7 @@ func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarsh
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||||
Buf: v,
|
Buf: v,
|
||||||
Message: m.ProtoReflect(),
|
Message: m.ProtoReflect(),
|
||||||
})
|
})
|
||||||
|
|
@ -288,27 +301,27 @@ func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarsh
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
out.n = n
|
out.n = n
|
||||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func sizeMessageValue(v pref.Value, tagsize int, opts marshalOptions) int {
|
func sizeMessageValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
return sizeMessage(m, tagsize, opts)
|
return sizeMessage(m, tagsize, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendMessageValue(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
func appendMessageValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
return appendMessage(b, m, wiretag, opts)
|
return appendMessage(b, m, wiretag, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func consumeMessageValue(b []byte, v pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {
|
func consumeMessageValue(b []byte, v protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (protoreflect.Value, unmarshalOutput, error) {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
out, err := consumeMessage(b, m, wtyp, opts)
|
out, err := consumeMessage(b, m, wtyp, opts)
|
||||||
return v, out, err
|
return v, out, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func isInitMessageValue(v pref.Value) error {
|
func isInitMessageValue(v protoreflect.Value) error {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
return proto.CheckInitialized(m)
|
return proto.CheckInitialized(m)
|
||||||
}
|
}
|
||||||
|
|
@ -321,17 +334,17 @@ var coderMessageValue = valueCoderFuncs{
|
||||||
merge: mergeMessageValue,
|
merge: mergeMessageValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
func sizeGroupValue(v pref.Value, tagsize int, opts marshalOptions) int {
|
func sizeGroupValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
return sizeGroup(m, tagsize, opts)
|
return sizeGroup(m, tagsize, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendGroupValue(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
func appendGroupValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
return appendGroup(b, m, wiretag, opts)
|
return appendGroup(b, m, wiretag, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func consumeGroupValue(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {
|
func consumeGroupValue(b []byte, v protoreflect.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (protoreflect.Value, unmarshalOutput, error) {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
out, err := consumeGroup(b, m, num, wtyp, opts)
|
out, err := consumeGroup(b, m, num, wtyp, opts)
|
||||||
return v, out, err
|
return v, out, err
|
||||||
|
|
@ -345,7 +358,7 @@ var coderGroupValue = valueCoderFuncs{
|
||||||
merge: mergeMessageValue,
|
merge: mergeMessageValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeGroupFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
func makeGroupFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||||
num := fd.Number()
|
num := fd.Number()
|
||||||
if mi := getMessageInfo(ft); mi != nil {
|
if mi := getMessageInfo(ft); mi != nil {
|
||||||
funcs := pointerCoderFuncs{
|
funcs := pointerCoderFuncs{
|
||||||
|
|
@ -405,8 +418,8 @@ func consumeGroupType(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf
|
||||||
return f.mi.unmarshalPointer(b, p.Elem(), f.num, opts)
|
return f.mi.unmarshalPointer(b, p.Elem(), f.num, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func sizeGroup(m proto.Message, tagsize int, _ marshalOptions) int {
|
func sizeGroup(m proto.Message, tagsize int, opts marshalOptions) int {
|
||||||
return 2*tagsize + proto.Size(m)
|
return 2*tagsize + opts.Options().Size(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendGroup(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
func appendGroup(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||||
|
|
@ -424,7 +437,7 @@ func consumeGroup(b []byte, m proto.Message, num protowire.Number, wtyp protowir
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||||
Buf: b,
|
Buf: b,
|
||||||
Message: m.ProtoReflect(),
|
Message: m.ProtoReflect(),
|
||||||
})
|
})
|
||||||
|
|
@ -432,11 +445,11 @@ func consumeGroup(b []byte, m proto.Message, num protowire.Number, wtyp protowir
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
out.n = n
|
out.n = n
|
||||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeMessageSliceFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
func makeMessageSliceFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||||
if mi := getMessageInfo(ft); mi != nil {
|
if mi := getMessageInfo(ft); mi != nil {
|
||||||
funcs := pointerCoderFuncs{
|
funcs := pointerCoderFuncs{
|
||||||
size: sizeMessageSliceInfo,
|
size: sizeMessageSliceInfo,
|
||||||
|
|
@ -482,10 +495,14 @@ func appendMessageSliceInfo(b []byte, p pointer, f *coderFieldInfo, opts marshal
|
||||||
b = protowire.AppendVarint(b, f.wiretag)
|
b = protowire.AppendVarint(b, f.wiretag)
|
||||||
siz := f.mi.sizePointer(v, opts)
|
siz := f.mi.sizePointer(v, opts)
|
||||||
b = protowire.AppendVarint(b, uint64(siz))
|
b = protowire.AppendVarint(b, uint64(siz))
|
||||||
|
before := len(b)
|
||||||
b, err = f.mi.marshalAppendPointer(b, v, opts)
|
b, err = f.mi.marshalAppendPointer(b, v, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return b, err
|
return b, err
|
||||||
}
|
}
|
||||||
|
if measuredSize := len(b) - before; siz != measuredSize {
|
||||||
|
return nil, errors.MismatchedSizeCalculation(siz, measuredSize)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
@ -520,28 +537,34 @@ func isInitMessageSliceInfo(p pointer, f *coderFieldInfo) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func sizeMessageSlice(p pointer, goType reflect.Type, tagsize int, _ marshalOptions) int {
|
func sizeMessageSlice(p pointer, goType reflect.Type, tagsize int, opts marshalOptions) int {
|
||||||
|
mopts := opts.Options()
|
||||||
s := p.PointerSlice()
|
s := p.PointerSlice()
|
||||||
n := 0
|
n := 0
|
||||||
for _, v := range s {
|
for _, v := range s {
|
||||||
m := asMessage(v.AsValueOf(goType.Elem()))
|
m := asMessage(v.AsValueOf(goType.Elem()))
|
||||||
n += protowire.SizeBytes(proto.Size(m)) + tagsize
|
n += protowire.SizeBytes(mopts.Size(m)) + tagsize
|
||||||
}
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendMessageSlice(b []byte, p pointer, wiretag uint64, goType reflect.Type, opts marshalOptions) ([]byte, error) {
|
func appendMessageSlice(b []byte, p pointer, wiretag uint64, goType reflect.Type, opts marshalOptions) ([]byte, error) {
|
||||||
|
mopts := opts.Options()
|
||||||
s := p.PointerSlice()
|
s := p.PointerSlice()
|
||||||
var err error
|
var err error
|
||||||
for _, v := range s {
|
for _, v := range s {
|
||||||
m := asMessage(v.AsValueOf(goType.Elem()))
|
m := asMessage(v.AsValueOf(goType.Elem()))
|
||||||
b = protowire.AppendVarint(b, wiretag)
|
b = protowire.AppendVarint(b, wiretag)
|
||||||
siz := proto.Size(m)
|
siz := mopts.Size(m)
|
||||||
b = protowire.AppendVarint(b, uint64(siz))
|
b = protowire.AppendVarint(b, uint64(siz))
|
||||||
b, err = opts.Options().MarshalAppend(b, m)
|
before := len(b)
|
||||||
|
b, err = mopts.MarshalAppend(b, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return b, err
|
return b, err
|
||||||
}
|
}
|
||||||
|
if measuredSize := len(b) - before; siz != measuredSize {
|
||||||
|
return nil, errors.MismatchedSizeCalculation(siz, measuredSize)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
@ -555,7 +578,7 @@ func consumeMessageSlice(b []byte, p pointer, goType reflect.Type, wtyp protowir
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
mp := reflect.New(goType.Elem())
|
mp := reflect.New(goType.Elem())
|
||||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||||
Buf: v,
|
Buf: v,
|
||||||
Message: asMessage(mp).ProtoReflect(),
|
Message: asMessage(mp).ProtoReflect(),
|
||||||
})
|
})
|
||||||
|
|
@ -564,7 +587,7 @@ func consumeMessageSlice(b []byte, p pointer, goType reflect.Type, wtyp protowir
|
||||||
}
|
}
|
||||||
p.AppendPointerSlice(pointerOfValue(mp))
|
p.AppendPointerSlice(pointerOfValue(mp))
|
||||||
out.n = n
|
out.n = n
|
||||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -581,57 +604,62 @@ func isInitMessageSlice(p pointer, goType reflect.Type) error {
|
||||||
|
|
||||||
// Slices of messages
|
// Slices of messages
|
||||||
|
|
||||||
func sizeMessageSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int {
|
func sizeMessageSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int {
|
||||||
|
mopts := opts.Options()
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
n := 0
|
n := 0
|
||||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||||
m := list.Get(i).Message().Interface()
|
m := list.Get(i).Message().Interface()
|
||||||
n += protowire.SizeBytes(proto.Size(m)) + tagsize
|
n += protowire.SizeBytes(mopts.Size(m)) + tagsize
|
||||||
}
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendMessageSliceValue(b []byte, listv pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
func appendMessageSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
mopts := opts.Options()
|
mopts := opts.Options()
|
||||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||||
m := list.Get(i).Message().Interface()
|
m := list.Get(i).Message().Interface()
|
||||||
b = protowire.AppendVarint(b, wiretag)
|
b = protowire.AppendVarint(b, wiretag)
|
||||||
siz := proto.Size(m)
|
siz := mopts.Size(m)
|
||||||
b = protowire.AppendVarint(b, uint64(siz))
|
b = protowire.AppendVarint(b, uint64(siz))
|
||||||
|
before := len(b)
|
||||||
var err error
|
var err error
|
||||||
b, err = mopts.MarshalAppend(b, m)
|
b, err = mopts.MarshalAppend(b, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return b, err
|
return b, err
|
||||||
}
|
}
|
||||||
|
if measuredSize := len(b) - before; siz != measuredSize {
|
||||||
|
return nil, errors.MismatchedSizeCalculation(siz, measuredSize)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func consumeMessageSliceValue(b []byte, listv pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {
|
func consumeMessageSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
if wtyp != protowire.BytesType {
|
if wtyp != protowire.BytesType {
|
||||||
return pref.Value{}, out, errUnknown
|
return protoreflect.Value{}, out, errUnknown
|
||||||
}
|
}
|
||||||
v, n := protowire.ConsumeBytes(b)
|
v, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return pref.Value{}, out, errDecode
|
return protoreflect.Value{}, out, errDecode
|
||||||
}
|
}
|
||||||
m := list.NewElement()
|
m := list.NewElement()
|
||||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||||
Buf: v,
|
Buf: v,
|
||||||
Message: m.Message(),
|
Message: m.Message(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pref.Value{}, out, err
|
return protoreflect.Value{}, out, err
|
||||||
}
|
}
|
||||||
list.Append(m)
|
list.Append(m)
|
||||||
out.n = n
|
out.n = n
|
||||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||||
return listv, out, nil
|
return listv, out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func isInitMessageSliceValue(listv pref.Value) error {
|
func isInitMessageSliceValue(listv protoreflect.Value) error {
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||||
m := list.Get(i).Message().Interface()
|
m := list.Get(i).Message().Interface()
|
||||||
|
|
@ -650,17 +678,18 @@ var coderMessageSliceValue = valueCoderFuncs{
|
||||||
merge: mergeMessageListValue,
|
merge: mergeMessageListValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
func sizeGroupSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int {
|
func sizeGroupSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int {
|
||||||
|
mopts := opts.Options()
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
n := 0
|
n := 0
|
||||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||||
m := list.Get(i).Message().Interface()
|
m := list.Get(i).Message().Interface()
|
||||||
n += 2*tagsize + proto.Size(m)
|
n += 2*tagsize + mopts.Size(m)
|
||||||
}
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendGroupSliceValue(b []byte, listv pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
func appendGroupSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
mopts := opts.Options()
|
mopts := opts.Options()
|
||||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||||
|
|
@ -676,26 +705,26 @@ func appendGroupSliceValue(b []byte, listv pref.Value, wiretag uint64, opts mars
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func consumeGroupSliceValue(b []byte, listv pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {
|
func consumeGroupSliceValue(b []byte, listv protoreflect.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
if wtyp != protowire.StartGroupType {
|
if wtyp != protowire.StartGroupType {
|
||||||
return pref.Value{}, out, errUnknown
|
return protoreflect.Value{}, out, errUnknown
|
||||||
}
|
}
|
||||||
b, n := protowire.ConsumeGroup(num, b)
|
b, n := protowire.ConsumeGroup(num, b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return pref.Value{}, out, errDecode
|
return protoreflect.Value{}, out, errDecode
|
||||||
}
|
}
|
||||||
m := list.NewElement()
|
m := list.NewElement()
|
||||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||||
Buf: b,
|
Buf: b,
|
||||||
Message: m.Message(),
|
Message: m.Message(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pref.Value{}, out, err
|
return protoreflect.Value{}, out, err
|
||||||
}
|
}
|
||||||
list.Append(m)
|
list.Append(m)
|
||||||
out.n = n
|
out.n = n
|
||||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||||
return listv, out, nil
|
return listv, out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -707,7 +736,7 @@ var coderGroupSliceValue = valueCoderFuncs{
|
||||||
merge: mergeMessageListValue,
|
merge: mergeMessageListValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeGroupSliceFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
func makeGroupSliceFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||||
num := fd.Number()
|
num := fd.Number()
|
||||||
if mi := getMessageInfo(ft); mi != nil {
|
if mi := getMessageInfo(ft); mi != nil {
|
||||||
funcs := pointerCoderFuncs{
|
funcs := pointerCoderFuncs{
|
||||||
|
|
@ -738,12 +767,13 @@ func makeGroupSliceFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func sizeGroupSlice(p pointer, messageType reflect.Type, tagsize int, _ marshalOptions) int {
|
func sizeGroupSlice(p pointer, messageType reflect.Type, tagsize int, opts marshalOptions) int {
|
||||||
|
mopts := opts.Options()
|
||||||
s := p.PointerSlice()
|
s := p.PointerSlice()
|
||||||
n := 0
|
n := 0
|
||||||
for _, v := range s {
|
for _, v := range s {
|
||||||
m := asMessage(v.AsValueOf(messageType.Elem()))
|
m := asMessage(v.AsValueOf(messageType.Elem()))
|
||||||
n += 2*tagsize + proto.Size(m)
|
n += 2*tagsize + mopts.Size(m)
|
||||||
}
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
@ -772,7 +802,7 @@ func consumeGroupSlice(b []byte, p pointer, num protowire.Number, wtyp protowire
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
mp := reflect.New(goType.Elem())
|
mp := reflect.New(goType.Elem())
|
||||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||||
Buf: b,
|
Buf: b,
|
||||||
Message: asMessage(mp).ProtoReflect(),
|
Message: asMessage(mp).ProtoReflect(),
|
||||||
})
|
})
|
||||||
|
|
@ -781,7 +811,7 @@ func consumeGroupSlice(b []byte, p pointer, num protowire.Number, wtyp protowire
|
||||||
}
|
}
|
||||||
p.AppendPointerSlice(pointerOfValue(mp))
|
p.AppendPointerSlice(pointerOfValue(mp))
|
||||||
out.n = n
|
out.n = n
|
||||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -822,8 +852,8 @@ func consumeGroupSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFie
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func asMessage(v reflect.Value) pref.ProtoMessage {
|
func asMessage(v reflect.Value) protoreflect.ProtoMessage {
|
||||||
if m, ok := v.Interface().(pref.ProtoMessage); ok {
|
if m, ok := v.Interface().(protoreflect.ProtoMessage); ok {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
return legacyWrapMessage(v).Interface()
|
return legacyWrapMessage(v).Interface()
|
||||||
|
|
|
||||||
113
vendor/google.golang.org/protobuf/internal/impl/codec_gen.go
generated
vendored
113
vendor/google.golang.org/protobuf/internal/impl/codec_gen.go
generated
vendored
|
|
@ -162,11 +162,20 @@ func appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions
|
||||||
func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.BoolSlice()
|
sp := p.BoolSlice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growBoolSlice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
|
@ -732,11 +741,20 @@ func appendInt32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOption
|
||||||
func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Int32Slice()
|
sp := p.Int32Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growInt32Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
|
@ -1138,11 +1156,20 @@ func appendSint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio
|
||||||
func consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Int32Slice()
|
sp := p.Int32Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growInt32Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
|
@ -1544,11 +1571,20 @@ func appendUint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio
|
||||||
func consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Uint32Slice()
|
sp := p.Uint32Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growUint32Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
|
@ -1950,11 +1986,20 @@ func appendInt64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOption
|
||||||
func consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Int64Slice()
|
sp := p.Int64Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growInt64Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
|
@ -2356,11 +2401,20 @@ func appendSint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio
|
||||||
func consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Int64Slice()
|
sp := p.Int64Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growInt64Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
|
@ -2762,11 +2816,20 @@ func appendUint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio
|
||||||
func consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Uint64Slice()
|
sp := p.Uint64Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growUint64Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
|
@ -3145,11 +3208,15 @@ func appendSfixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOpt
|
||||||
func consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Int32Slice()
|
sp := p.Int32Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := len(b) / protowire.SizeFixed32()
|
||||||
|
if count > 0 {
|
||||||
|
p.growInt32Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
v, n := protowire.ConsumeFixed32(b)
|
v, n := protowire.ConsumeFixed32(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
|
@ -3461,11 +3528,15 @@ func appendFixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOpti
|
||||||
func consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Uint32Slice()
|
sp := p.Uint32Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := len(b) / protowire.SizeFixed32()
|
||||||
|
if count > 0 {
|
||||||
|
p.growUint32Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
v, n := protowire.ConsumeFixed32(b)
|
v, n := protowire.ConsumeFixed32(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
|
@ -3777,11 +3848,15 @@ func appendFloatSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOption
|
||||||
func consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Float32Slice()
|
sp := p.Float32Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := len(b) / protowire.SizeFixed32()
|
||||||
|
if count > 0 {
|
||||||
|
p.growFloat32Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
v, n := protowire.ConsumeFixed32(b)
|
v, n := protowire.ConsumeFixed32(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
|
@ -4093,11 +4168,15 @@ func appendSfixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOpt
|
||||||
func consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Int64Slice()
|
sp := p.Int64Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := len(b) / protowire.SizeFixed64()
|
||||||
|
if count > 0 {
|
||||||
|
p.growInt64Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
v, n := protowire.ConsumeFixed64(b)
|
v, n := protowire.ConsumeFixed64(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
|
@ -4409,11 +4488,15 @@ func appendFixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOpti
|
||||||
func consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Uint64Slice()
|
sp := p.Uint64Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := len(b) / protowire.SizeFixed64()
|
||||||
|
if count > 0 {
|
||||||
|
p.growUint64Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
v, n := protowire.ConsumeFixed64(b)
|
v, n := protowire.ConsumeFixed64(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
|
@ -4725,11 +4808,15 @@ func appendDoubleSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio
|
||||||
func consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Float64Slice()
|
sp := p.Float64Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := len(b) / protowire.SizeFixed64()
|
||||||
|
if count > 0 {
|
||||||
|
p.growFloat64Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
v, n := protowire.ConsumeFixed64(b)
|
v, n := protowire.ConsumeFixed64(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
|
|
||||||
35
vendor/google.golang.org/protobuf/internal/impl/codec_map.go
generated
vendored
35
vendor/google.golang.org/protobuf/internal/impl/codec_map.go
generated
vendored
|
|
@ -9,8 +9,9 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
|
"google.golang.org/protobuf/internal/errors"
|
||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mapInfo struct {
|
type mapInfo struct {
|
||||||
|
|
@ -19,12 +20,12 @@ type mapInfo struct {
|
||||||
valWiretag uint64
|
valWiretag uint64
|
||||||
keyFuncs valueCoderFuncs
|
keyFuncs valueCoderFuncs
|
||||||
valFuncs valueCoderFuncs
|
valFuncs valueCoderFuncs
|
||||||
keyZero pref.Value
|
keyZero protoreflect.Value
|
||||||
keyKind pref.Kind
|
keyKind protoreflect.Kind
|
||||||
conv *mapConverter
|
conv *mapConverter
|
||||||
}
|
}
|
||||||
|
|
||||||
func encoderFuncsForMap(fd pref.FieldDescriptor, ft reflect.Type) (valueMessage *MessageInfo, funcs pointerCoderFuncs) {
|
func encoderFuncsForMap(fd protoreflect.FieldDescriptor, ft reflect.Type) (valueMessage *MessageInfo, funcs pointerCoderFuncs) {
|
||||||
// TODO: Consider generating specialized map coders.
|
// TODO: Consider generating specialized map coders.
|
||||||
keyField := fd.MapKey()
|
keyField := fd.MapKey()
|
||||||
valField := fd.MapValue()
|
valField := fd.MapValue()
|
||||||
|
|
@ -44,7 +45,7 @@ func encoderFuncsForMap(fd pref.FieldDescriptor, ft reflect.Type) (valueMessage
|
||||||
keyKind: keyField.Kind(),
|
keyKind: keyField.Kind(),
|
||||||
conv: conv,
|
conv: conv,
|
||||||
}
|
}
|
||||||
if valField.Kind() == pref.MessageKind {
|
if valField.Kind() == protoreflect.MessageKind {
|
||||||
valueMessage = getMessageInfo(ft.Elem())
|
valueMessage = getMessageInfo(ft.Elem())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,9 +69,9 @@ func encoderFuncsForMap(fd pref.FieldDescriptor, ft reflect.Type) (valueMessage
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
switch valField.Kind() {
|
switch valField.Kind() {
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
funcs.merge = mergeMapOfMessage
|
funcs.merge = mergeMapOfMessage
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
funcs.merge = mergeMapOfBytes
|
funcs.merge = mergeMapOfBytes
|
||||||
default:
|
default:
|
||||||
funcs.merge = mergeMap
|
funcs.merge = mergeMap
|
||||||
|
|
@ -135,7 +136,7 @@ func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo
|
||||||
err := errUnknown
|
err := errUnknown
|
||||||
switch num {
|
switch num {
|
||||||
case genid.MapEntry_Key_field_number:
|
case genid.MapEntry_Key_field_number:
|
||||||
var v pref.Value
|
var v protoreflect.Value
|
||||||
var o unmarshalOutput
|
var o unmarshalOutput
|
||||||
v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)
|
v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -144,7 +145,7 @@ func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo
|
||||||
key = v
|
key = v
|
||||||
n = o.n
|
n = o.n
|
||||||
case genid.MapEntry_Value_field_number:
|
case genid.MapEntry_Value_field_number:
|
||||||
var v pref.Value
|
var v protoreflect.Value
|
||||||
var o unmarshalOutput
|
var o unmarshalOutput
|
||||||
v, o, err = mapi.valFuncs.unmarshal(b, val, num, wtyp, opts)
|
v, o, err = mapi.valFuncs.unmarshal(b, val, num, wtyp, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -192,7 +193,7 @@ func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi
|
||||||
err := errUnknown
|
err := errUnknown
|
||||||
switch num {
|
switch num {
|
||||||
case 1:
|
case 1:
|
||||||
var v pref.Value
|
var v protoreflect.Value
|
||||||
var o unmarshalOutput
|
var o unmarshalOutput
|
||||||
v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)
|
v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -240,11 +241,16 @@ func appendMapItem(b []byte, keyrv, valrv reflect.Value, mapi *mapInfo, f *coder
|
||||||
size += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)
|
size += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)
|
||||||
size += mapi.valFuncs.size(val, mapValTagSize, opts)
|
size += mapi.valFuncs.size(val, mapValTagSize, opts)
|
||||||
b = protowire.AppendVarint(b, uint64(size))
|
b = protowire.AppendVarint(b, uint64(size))
|
||||||
|
before := len(b)
|
||||||
b, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts)
|
b, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return mapi.valFuncs.marshal(b, val, mapi.valWiretag, opts)
|
b, err = mapi.valFuncs.marshal(b, val, mapi.valWiretag, opts)
|
||||||
|
if measuredSize := len(b) - before; size != measuredSize && err == nil {
|
||||||
|
return nil, errors.MismatchedSizeCalculation(size, measuredSize)
|
||||||
|
}
|
||||||
|
return b, err
|
||||||
} else {
|
} else {
|
||||||
key := mapi.conv.keyConv.PBValueOf(keyrv).MapKey()
|
key := mapi.conv.keyConv.PBValueOf(keyrv).MapKey()
|
||||||
val := pointerOfValue(valrv)
|
val := pointerOfValue(valrv)
|
||||||
|
|
@ -259,7 +265,12 @@ func appendMapItem(b []byte, keyrv, valrv reflect.Value, mapi *mapInfo, f *coder
|
||||||
}
|
}
|
||||||
b = protowire.AppendVarint(b, mapi.valWiretag)
|
b = protowire.AppendVarint(b, mapi.valWiretag)
|
||||||
b = protowire.AppendVarint(b, uint64(valSize))
|
b = protowire.AppendVarint(b, uint64(valSize))
|
||||||
return f.mi.marshalAppendPointer(b, val, opts)
|
before := len(b)
|
||||||
|
b, err = f.mi.marshalAppendPointer(b, val, opts)
|
||||||
|
if measuredSize := len(b) - before; valSize != measuredSize && err == nil {
|
||||||
|
return nil, errors.MismatchedSizeCalculation(valSize, measuredSize)
|
||||||
|
}
|
||||||
|
return b, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1
vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go
generated
vendored
1
vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !go1.12
|
||||||
// +build !go1.12
|
// +build !go1.12
|
||||||
|
|
||||||
package impl
|
package impl
|
||||||
|
|
|
||||||
1
vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go
generated
vendored
1
vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build go1.12
|
||||||
// +build go1.12
|
// +build go1.12
|
||||||
|
|
||||||
package impl
|
package impl
|
||||||
|
|
|
||||||
30
vendor/google.golang.org/protobuf/internal/impl/codec_message.go
generated
vendored
30
vendor/google.golang.org/protobuf/internal/impl/codec_message.go
generated
vendored
|
|
@ -12,15 +12,15 @@ import (
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/encoding/messageset"
|
"google.golang.org/protobuf/internal/encoding/messageset"
|
||||||
"google.golang.org/protobuf/internal/order"
|
"google.golang.org/protobuf/internal/order"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
// coderMessageInfo contains per-message information used by the fast-path functions.
|
// coderMessageInfo contains per-message information used by the fast-path functions.
|
||||||
// This is a different type from MessageInfo to keep MessageInfo as general-purpose as
|
// This is a different type from MessageInfo to keep MessageInfo as general-purpose as
|
||||||
// possible.
|
// possible.
|
||||||
type coderMessageInfo struct {
|
type coderMessageInfo struct {
|
||||||
methods piface.Methods
|
methods protoiface.Methods
|
||||||
|
|
||||||
orderedCoderFields []*coderFieldInfo
|
orderedCoderFields []*coderFieldInfo
|
||||||
denseCoderFields []*coderFieldInfo
|
denseCoderFields []*coderFieldInfo
|
||||||
|
|
@ -38,13 +38,13 @@ type coderFieldInfo struct {
|
||||||
funcs pointerCoderFuncs // fast-path per-field functions
|
funcs pointerCoderFuncs // fast-path per-field functions
|
||||||
mi *MessageInfo // field's message
|
mi *MessageInfo // field's message
|
||||||
ft reflect.Type
|
ft reflect.Type
|
||||||
validation validationInfo // information used by message validation
|
validation validationInfo // information used by message validation
|
||||||
num pref.FieldNumber // field number
|
num protoreflect.FieldNumber // field number
|
||||||
offset offset // struct field offset
|
offset offset // struct field offset
|
||||||
wiretag uint64 // field tag (number + wire type)
|
wiretag uint64 // field tag (number + wire type)
|
||||||
tagsize int // size of the varint-encoded tag
|
tagsize int // size of the varint-encoded tag
|
||||||
isPointer bool // true if IsNil may be called on the struct field
|
isPointer bool // true if IsNil may be called on the struct field
|
||||||
isRequired bool // true if field is required
|
isRequired bool // true if field is required
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
||||||
|
|
@ -125,8 +125,8 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
||||||
funcs: funcs,
|
funcs: funcs,
|
||||||
mi: childMessage,
|
mi: childMessage,
|
||||||
validation: newFieldValidationInfo(mi, si, fd, ft),
|
validation: newFieldValidationInfo(mi, si, fd, ft),
|
||||||
isPointer: fd.Cardinality() == pref.Repeated || fd.HasPresence(),
|
isPointer: fd.Cardinality() == protoreflect.Repeated || fd.HasPresence(),
|
||||||
isRequired: fd.Cardinality() == pref.Required,
|
isRequired: fd.Cardinality() == protoreflect.Required,
|
||||||
}
|
}
|
||||||
mi.orderedCoderFields = append(mi.orderedCoderFields, cf)
|
mi.orderedCoderFields = append(mi.orderedCoderFields, cf)
|
||||||
mi.coderFields[cf.num] = cf
|
mi.coderFields[cf.num] = cf
|
||||||
|
|
@ -149,7 +149,7 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
||||||
return mi.orderedCoderFields[i].num < mi.orderedCoderFields[j].num
|
return mi.orderedCoderFields[i].num < mi.orderedCoderFields[j].num
|
||||||
})
|
})
|
||||||
|
|
||||||
var maxDense pref.FieldNumber
|
var maxDense protoreflect.FieldNumber
|
||||||
for _, cf := range mi.orderedCoderFields {
|
for _, cf := range mi.orderedCoderFields {
|
||||||
if cf.num >= 16 && cf.num >= 2*maxDense {
|
if cf.num >= 16 && cf.num >= 2*maxDense {
|
||||||
break
|
break
|
||||||
|
|
@ -175,12 +175,12 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
||||||
|
|
||||||
mi.needsInitCheck = needsInitCheck(mi.Desc)
|
mi.needsInitCheck = needsInitCheck(mi.Desc)
|
||||||
if mi.methods.Marshal == nil && mi.methods.Size == nil {
|
if mi.methods.Marshal == nil && mi.methods.Size == nil {
|
||||||
mi.methods.Flags |= piface.SupportMarshalDeterministic
|
mi.methods.Flags |= protoiface.SupportMarshalDeterministic
|
||||||
mi.methods.Marshal = mi.marshal
|
mi.methods.Marshal = mi.marshal
|
||||||
mi.methods.Size = mi.size
|
mi.methods.Size = mi.size
|
||||||
}
|
}
|
||||||
if mi.methods.Unmarshal == nil {
|
if mi.methods.Unmarshal == nil {
|
||||||
mi.methods.Flags |= piface.SupportUnmarshalDiscardUnknown
|
mi.methods.Flags |= protoiface.SupportUnmarshalDiscardUnknown
|
||||||
mi.methods.Unmarshal = mi.unmarshal
|
mi.methods.Unmarshal = mi.unmarshal
|
||||||
}
|
}
|
||||||
if mi.methods.CheckInitialized == nil {
|
if mi.methods.CheckInitialized == nil {
|
||||||
|
|
|
||||||
1
vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go
generated
vendored
1
vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build purego || appengine
|
||||||
// +build purego appengine
|
// +build purego appengine
|
||||||
|
|
||||||
package impl
|
package impl
|
||||||
|
|
|
||||||
290
vendor/google.golang.org/protobuf/internal/impl/codec_tables.go
generated
vendored
290
vendor/google.golang.org/protobuf/internal/impl/codec_tables.go
generated
vendored
|
|
@ -10,7 +10,7 @@ import (
|
||||||
|
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// pointerCoderFuncs is a set of pointer encoding functions.
|
// pointerCoderFuncs is a set of pointer encoding functions.
|
||||||
|
|
@ -25,83 +25,83 @@ type pointerCoderFuncs struct {
|
||||||
|
|
||||||
// valueCoderFuncs is a set of protoreflect.Value encoding functions.
|
// valueCoderFuncs is a set of protoreflect.Value encoding functions.
|
||||||
type valueCoderFuncs struct {
|
type valueCoderFuncs struct {
|
||||||
size func(v pref.Value, tagsize int, opts marshalOptions) int
|
size func(v protoreflect.Value, tagsize int, opts marshalOptions) int
|
||||||
marshal func(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error)
|
marshal func(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error)
|
||||||
unmarshal func(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error)
|
unmarshal func(b []byte, v protoreflect.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (protoreflect.Value, unmarshalOutput, error)
|
||||||
isInit func(v pref.Value) error
|
isInit func(v protoreflect.Value) error
|
||||||
merge func(dst, src pref.Value, opts mergeOptions) pref.Value
|
merge func(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
// fieldCoder returns pointer functions for a field, used for operating on
|
// fieldCoder returns pointer functions for a field, used for operating on
|
||||||
// struct fields.
|
// struct fields.
|
||||||
func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointerCoderFuncs) {
|
func fieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointerCoderFuncs) {
|
||||||
switch {
|
switch {
|
||||||
case fd.IsMap():
|
case fd.IsMap():
|
||||||
return encoderFuncsForMap(fd, ft)
|
return encoderFuncsForMap(fd, ft)
|
||||||
case fd.Cardinality() == pref.Repeated && !fd.IsPacked():
|
case fd.Cardinality() == protoreflect.Repeated && !fd.IsPacked():
|
||||||
// Repeated fields (not packed).
|
// Repeated fields (not packed).
|
||||||
if ft.Kind() != reflect.Slice {
|
if ft.Kind() != reflect.Slice {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
ft := ft.Elem()
|
ft := ft.Elem()
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if ft.Kind() == reflect.Bool {
|
if ft.Kind() == reflect.Bool {
|
||||||
return nil, coderBoolSlice
|
return nil, coderBoolSlice
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderEnumSlice
|
return nil, coderEnumSlice
|
||||||
}
|
}
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderInt32Slice
|
return nil, coderInt32Slice
|
||||||
}
|
}
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSint32Slice
|
return nil, coderSint32Slice
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderUint32Slice
|
return nil, coderUint32Slice
|
||||||
}
|
}
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderInt64Slice
|
return nil, coderInt64Slice
|
||||||
}
|
}
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSint64Slice
|
return nil, coderSint64Slice
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderUint64Slice
|
return nil, coderUint64Slice
|
||||||
}
|
}
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSfixed32Slice
|
return nil, coderSfixed32Slice
|
||||||
}
|
}
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderFixed32Slice
|
return nil, coderFixed32Slice
|
||||||
}
|
}
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if ft.Kind() == reflect.Float32 {
|
if ft.Kind() == reflect.Float32 {
|
||||||
return nil, coderFloatSlice
|
return nil, coderFloatSlice
|
||||||
}
|
}
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSfixed64Slice
|
return nil, coderSfixed64Slice
|
||||||
}
|
}
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderFixed64Slice
|
return nil, coderFixed64Slice
|
||||||
}
|
}
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if ft.Kind() == reflect.Float64 {
|
if ft.Kind() == reflect.Float64 {
|
||||||
return nil, coderDoubleSlice
|
return nil, coderDoubleSlice
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
||||||
return nil, coderStringSliceValidateUTF8
|
return nil, coderStringSliceValidateUTF8
|
||||||
}
|
}
|
||||||
|
|
@ -114,19 +114,19 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
||||||
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
||||||
return nil, coderBytesSlice
|
return nil, coderBytesSlice
|
||||||
}
|
}
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if ft.Kind() == reflect.String {
|
if ft.Kind() == reflect.String {
|
||||||
return nil, coderStringSlice
|
return nil, coderStringSlice
|
||||||
}
|
}
|
||||||
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
||||||
return nil, coderBytesSlice
|
return nil, coderBytesSlice
|
||||||
}
|
}
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
return getMessageInfo(ft), makeMessageSliceFieldCoder(fd, ft)
|
return getMessageInfo(ft), makeMessageSliceFieldCoder(fd, ft)
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
return getMessageInfo(ft), makeGroupSliceFieldCoder(fd, ft)
|
return getMessageInfo(ft), makeGroupSliceFieldCoder(fd, ft)
|
||||||
}
|
}
|
||||||
case fd.Cardinality() == pref.Repeated && fd.IsPacked():
|
case fd.Cardinality() == protoreflect.Repeated && fd.IsPacked():
|
||||||
// Packed repeated fields.
|
// Packed repeated fields.
|
||||||
//
|
//
|
||||||
// Only repeated fields of primitive numeric types
|
// Only repeated fields of primitive numeric types
|
||||||
|
|
@ -136,128 +136,128 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
||||||
}
|
}
|
||||||
ft := ft.Elem()
|
ft := ft.Elem()
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if ft.Kind() == reflect.Bool {
|
if ft.Kind() == reflect.Bool {
|
||||||
return nil, coderBoolPackedSlice
|
return nil, coderBoolPackedSlice
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderEnumPackedSlice
|
return nil, coderEnumPackedSlice
|
||||||
}
|
}
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderInt32PackedSlice
|
return nil, coderInt32PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSint32PackedSlice
|
return nil, coderSint32PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderUint32PackedSlice
|
return nil, coderUint32PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderInt64PackedSlice
|
return nil, coderInt64PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSint64PackedSlice
|
return nil, coderSint64PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderUint64PackedSlice
|
return nil, coderUint64PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSfixed32PackedSlice
|
return nil, coderSfixed32PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderFixed32PackedSlice
|
return nil, coderFixed32PackedSlice
|
||||||
}
|
}
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if ft.Kind() == reflect.Float32 {
|
if ft.Kind() == reflect.Float32 {
|
||||||
return nil, coderFloatPackedSlice
|
return nil, coderFloatPackedSlice
|
||||||
}
|
}
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSfixed64PackedSlice
|
return nil, coderSfixed64PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderFixed64PackedSlice
|
return nil, coderFixed64PackedSlice
|
||||||
}
|
}
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if ft.Kind() == reflect.Float64 {
|
if ft.Kind() == reflect.Float64 {
|
||||||
return nil, coderDoublePackedSlice
|
return nil, coderDoublePackedSlice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case fd.Kind() == pref.MessageKind:
|
case fd.Kind() == protoreflect.MessageKind:
|
||||||
return getMessageInfo(ft), makeMessageFieldCoder(fd, ft)
|
return getMessageInfo(ft), makeMessageFieldCoder(fd, ft)
|
||||||
case fd.Kind() == pref.GroupKind:
|
case fd.Kind() == protoreflect.GroupKind:
|
||||||
return getMessageInfo(ft), makeGroupFieldCoder(fd, ft)
|
return getMessageInfo(ft), makeGroupFieldCoder(fd, ft)
|
||||||
case fd.Syntax() == pref.Proto3 && fd.ContainingOneof() == nil:
|
case !fd.HasPresence() && fd.ContainingOneof() == nil:
|
||||||
// Populated oneof fields always encode even if set to the zero value,
|
// Populated oneof fields always encode even if set to the zero value,
|
||||||
// which normally are not encoded in proto3.
|
// which normally are not encoded in proto3.
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if ft.Kind() == reflect.Bool {
|
if ft.Kind() == reflect.Bool {
|
||||||
return nil, coderBoolNoZero
|
return nil, coderBoolNoZero
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderEnumNoZero
|
return nil, coderEnumNoZero
|
||||||
}
|
}
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderInt32NoZero
|
return nil, coderInt32NoZero
|
||||||
}
|
}
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSint32NoZero
|
return nil, coderSint32NoZero
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderUint32NoZero
|
return nil, coderUint32NoZero
|
||||||
}
|
}
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderInt64NoZero
|
return nil, coderInt64NoZero
|
||||||
}
|
}
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSint64NoZero
|
return nil, coderSint64NoZero
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderUint64NoZero
|
return nil, coderUint64NoZero
|
||||||
}
|
}
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSfixed32NoZero
|
return nil, coderSfixed32NoZero
|
||||||
}
|
}
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderFixed32NoZero
|
return nil, coderFixed32NoZero
|
||||||
}
|
}
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if ft.Kind() == reflect.Float32 {
|
if ft.Kind() == reflect.Float32 {
|
||||||
return nil, coderFloatNoZero
|
return nil, coderFloatNoZero
|
||||||
}
|
}
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSfixed64NoZero
|
return nil, coderSfixed64NoZero
|
||||||
}
|
}
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderFixed64NoZero
|
return nil, coderFixed64NoZero
|
||||||
}
|
}
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if ft.Kind() == reflect.Float64 {
|
if ft.Kind() == reflect.Float64 {
|
||||||
return nil, coderDoubleNoZero
|
return nil, coderDoubleNoZero
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
||||||
return nil, coderStringNoZeroValidateUTF8
|
return nil, coderStringNoZeroValidateUTF8
|
||||||
}
|
}
|
||||||
|
|
@ -270,7 +270,7 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
||||||
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
||||||
return nil, coderBytesNoZero
|
return nil, coderBytesNoZero
|
||||||
}
|
}
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if ft.Kind() == reflect.String {
|
if ft.Kind() == reflect.String {
|
||||||
return nil, coderStringNoZero
|
return nil, coderStringNoZero
|
||||||
}
|
}
|
||||||
|
|
@ -281,133 +281,133 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
||||||
case ft.Kind() == reflect.Ptr:
|
case ft.Kind() == reflect.Ptr:
|
||||||
ft := ft.Elem()
|
ft := ft.Elem()
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if ft.Kind() == reflect.Bool {
|
if ft.Kind() == reflect.Bool {
|
||||||
return nil, coderBoolPtr
|
return nil, coderBoolPtr
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderEnumPtr
|
return nil, coderEnumPtr
|
||||||
}
|
}
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderInt32Ptr
|
return nil, coderInt32Ptr
|
||||||
}
|
}
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSint32Ptr
|
return nil, coderSint32Ptr
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderUint32Ptr
|
return nil, coderUint32Ptr
|
||||||
}
|
}
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderInt64Ptr
|
return nil, coderInt64Ptr
|
||||||
}
|
}
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSint64Ptr
|
return nil, coderSint64Ptr
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderUint64Ptr
|
return nil, coderUint64Ptr
|
||||||
}
|
}
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSfixed32Ptr
|
return nil, coderSfixed32Ptr
|
||||||
}
|
}
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderFixed32Ptr
|
return nil, coderFixed32Ptr
|
||||||
}
|
}
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if ft.Kind() == reflect.Float32 {
|
if ft.Kind() == reflect.Float32 {
|
||||||
return nil, coderFloatPtr
|
return nil, coderFloatPtr
|
||||||
}
|
}
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSfixed64Ptr
|
return nil, coderSfixed64Ptr
|
||||||
}
|
}
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderFixed64Ptr
|
return nil, coderFixed64Ptr
|
||||||
}
|
}
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if ft.Kind() == reflect.Float64 {
|
if ft.Kind() == reflect.Float64 {
|
||||||
return nil, coderDoublePtr
|
return nil, coderDoublePtr
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
||||||
return nil, coderStringPtrValidateUTF8
|
return nil, coderStringPtrValidateUTF8
|
||||||
}
|
}
|
||||||
if ft.Kind() == reflect.String {
|
if ft.Kind() == reflect.String {
|
||||||
return nil, coderStringPtr
|
return nil, coderStringPtr
|
||||||
}
|
}
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if ft.Kind() == reflect.String {
|
if ft.Kind() == reflect.String {
|
||||||
return nil, coderStringPtr
|
return nil, coderStringPtr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if ft.Kind() == reflect.Bool {
|
if ft.Kind() == reflect.Bool {
|
||||||
return nil, coderBool
|
return nil, coderBool
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderEnum
|
return nil, coderEnum
|
||||||
}
|
}
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderInt32
|
return nil, coderInt32
|
||||||
}
|
}
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSint32
|
return nil, coderSint32
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderUint32
|
return nil, coderUint32
|
||||||
}
|
}
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderInt64
|
return nil, coderInt64
|
||||||
}
|
}
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSint64
|
return nil, coderSint64
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderUint64
|
return nil, coderUint64
|
||||||
}
|
}
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSfixed32
|
return nil, coderSfixed32
|
||||||
}
|
}
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderFixed32
|
return nil, coderFixed32
|
||||||
}
|
}
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if ft.Kind() == reflect.Float32 {
|
if ft.Kind() == reflect.Float32 {
|
||||||
return nil, coderFloat
|
return nil, coderFloat
|
||||||
}
|
}
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSfixed64
|
return nil, coderSfixed64
|
||||||
}
|
}
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderFixed64
|
return nil, coderFixed64
|
||||||
}
|
}
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if ft.Kind() == reflect.Float64 {
|
if ft.Kind() == reflect.Float64 {
|
||||||
return nil, coderDouble
|
return nil, coderDouble
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
||||||
return nil, coderStringValidateUTF8
|
return nil, coderStringValidateUTF8
|
||||||
}
|
}
|
||||||
|
|
@ -420,7 +420,7 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
||||||
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
||||||
return nil, coderBytes
|
return nil, coderBytes
|
||||||
}
|
}
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if ft.Kind() == reflect.String {
|
if ft.Kind() == reflect.String {
|
||||||
return nil, coderString
|
return nil, coderString
|
||||||
}
|
}
|
||||||
|
|
@ -434,122 +434,122 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
||||||
|
|
||||||
// encoderFuncsForValue returns value functions for a field, used for
|
// encoderFuncsForValue returns value functions for a field, used for
|
||||||
// extension values and map encoding.
|
// extension values and map encoding.
|
||||||
func encoderFuncsForValue(fd pref.FieldDescriptor) valueCoderFuncs {
|
func encoderFuncsForValue(fd protoreflect.FieldDescriptor) valueCoderFuncs {
|
||||||
switch {
|
switch {
|
||||||
case fd.Cardinality() == pref.Repeated && !fd.IsPacked():
|
case fd.Cardinality() == protoreflect.Repeated && !fd.IsPacked():
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
return coderBoolSliceValue
|
return coderBoolSliceValue
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
return coderEnumSliceValue
|
return coderEnumSliceValue
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
return coderInt32SliceValue
|
return coderInt32SliceValue
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
return coderSint32SliceValue
|
return coderSint32SliceValue
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
return coderUint32SliceValue
|
return coderUint32SliceValue
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
return coderInt64SliceValue
|
return coderInt64SliceValue
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
return coderSint64SliceValue
|
return coderSint64SliceValue
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
return coderUint64SliceValue
|
return coderUint64SliceValue
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
return coderSfixed32SliceValue
|
return coderSfixed32SliceValue
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
return coderFixed32SliceValue
|
return coderFixed32SliceValue
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
return coderFloatSliceValue
|
return coderFloatSliceValue
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
return coderSfixed64SliceValue
|
return coderSfixed64SliceValue
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
return coderFixed64SliceValue
|
return coderFixed64SliceValue
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
return coderDoubleSliceValue
|
return coderDoubleSliceValue
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
// We don't have a UTF-8 validating coder for repeated string fields.
|
// We don't have a UTF-8 validating coder for repeated string fields.
|
||||||
// Value coders are used for extensions and maps.
|
// Value coders are used for extensions and maps.
|
||||||
// Extensions are never proto3, and maps never contain lists.
|
// Extensions are never proto3, and maps never contain lists.
|
||||||
return coderStringSliceValue
|
return coderStringSliceValue
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
return coderBytesSliceValue
|
return coderBytesSliceValue
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
return coderMessageSliceValue
|
return coderMessageSliceValue
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
return coderGroupSliceValue
|
return coderGroupSliceValue
|
||||||
}
|
}
|
||||||
case fd.Cardinality() == pref.Repeated && fd.IsPacked():
|
case fd.Cardinality() == protoreflect.Repeated && fd.IsPacked():
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
return coderBoolPackedSliceValue
|
return coderBoolPackedSliceValue
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
return coderEnumPackedSliceValue
|
return coderEnumPackedSliceValue
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
return coderInt32PackedSliceValue
|
return coderInt32PackedSliceValue
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
return coderSint32PackedSliceValue
|
return coderSint32PackedSliceValue
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
return coderUint32PackedSliceValue
|
return coderUint32PackedSliceValue
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
return coderInt64PackedSliceValue
|
return coderInt64PackedSliceValue
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
return coderSint64PackedSliceValue
|
return coderSint64PackedSliceValue
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
return coderUint64PackedSliceValue
|
return coderUint64PackedSliceValue
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
return coderSfixed32PackedSliceValue
|
return coderSfixed32PackedSliceValue
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
return coderFixed32PackedSliceValue
|
return coderFixed32PackedSliceValue
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
return coderFloatPackedSliceValue
|
return coderFloatPackedSliceValue
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
return coderSfixed64PackedSliceValue
|
return coderSfixed64PackedSliceValue
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
return coderFixed64PackedSliceValue
|
return coderFixed64PackedSliceValue
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
return coderDoublePackedSliceValue
|
return coderDoublePackedSliceValue
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
default:
|
default:
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
return coderBoolValue
|
return coderBoolValue
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
return coderEnumValue
|
return coderEnumValue
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
return coderInt32Value
|
return coderInt32Value
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
return coderSint32Value
|
return coderSint32Value
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
return coderUint32Value
|
return coderUint32Value
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
return coderInt64Value
|
return coderInt64Value
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
return coderSint64Value
|
return coderSint64Value
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
return coderUint64Value
|
return coderUint64Value
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
return coderSfixed32Value
|
return coderSfixed32Value
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
return coderFixed32Value
|
return coderFixed32Value
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
return coderFloatValue
|
return coderFloatValue
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
return coderSfixed64Value
|
return coderSfixed64Value
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
return coderFixed64Value
|
return coderFixed64Value
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
return coderDoubleValue
|
return coderDoubleValue
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if strs.EnforceUTF8(fd) {
|
if strs.EnforceUTF8(fd) {
|
||||||
return coderStringValueValidateUTF8
|
return coderStringValueValidateUTF8
|
||||||
}
|
}
|
||||||
return coderStringValue
|
return coderStringValue
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
return coderBytesValue
|
return coderBytesValue
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
return coderMessageValue
|
return coderMessageValue
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
return coderGroupValue
|
return coderGroupValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go
generated
vendored
1
vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !purego && !appengine
|
||||||
// +build !purego,!appengine
|
// +build !purego,!appengine
|
||||||
|
|
||||||
package impl
|
package impl
|
||||||
|
|
|
||||||
229
vendor/google.golang.org/protobuf/internal/impl/convert.go
generated
vendored
229
vendor/google.golang.org/protobuf/internal/impl/convert.go
generated
vendored
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// unwrapper unwraps the value to the underlying value.
|
// unwrapper unwraps the value to the underlying value.
|
||||||
|
|
@ -20,13 +20,13 @@ type unwrapper interface {
|
||||||
// A Converter coverts to/from Go reflect.Value types and protobuf protoreflect.Value types.
|
// A Converter coverts to/from Go reflect.Value types and protobuf protoreflect.Value types.
|
||||||
type Converter interface {
|
type Converter interface {
|
||||||
// PBValueOf converts a reflect.Value to a protoreflect.Value.
|
// PBValueOf converts a reflect.Value to a protoreflect.Value.
|
||||||
PBValueOf(reflect.Value) pref.Value
|
PBValueOf(reflect.Value) protoreflect.Value
|
||||||
|
|
||||||
// GoValueOf converts a protoreflect.Value to a reflect.Value.
|
// GoValueOf converts a protoreflect.Value to a reflect.Value.
|
||||||
GoValueOf(pref.Value) reflect.Value
|
GoValueOf(protoreflect.Value) reflect.Value
|
||||||
|
|
||||||
// IsValidPB returns whether a protoreflect.Value is compatible with this type.
|
// IsValidPB returns whether a protoreflect.Value is compatible with this type.
|
||||||
IsValidPB(pref.Value) bool
|
IsValidPB(protoreflect.Value) bool
|
||||||
|
|
||||||
// IsValidGo returns whether a reflect.Value is compatible with this type.
|
// IsValidGo returns whether a reflect.Value is compatible with this type.
|
||||||
IsValidGo(reflect.Value) bool
|
IsValidGo(reflect.Value) bool
|
||||||
|
|
@ -34,12 +34,12 @@ type Converter interface {
|
||||||
// New returns a new field value.
|
// New returns a new field value.
|
||||||
// For scalars, it returns the default value of the field.
|
// For scalars, it returns the default value of the field.
|
||||||
// For composite types, it returns a new mutable value.
|
// For composite types, it returns a new mutable value.
|
||||||
New() pref.Value
|
New() protoreflect.Value
|
||||||
|
|
||||||
// Zero returns a new field value.
|
// Zero returns a new field value.
|
||||||
// For scalars, it returns the default value of the field.
|
// For scalars, it returns the default value of the field.
|
||||||
// For composite types, it returns an immutable, empty value.
|
// For composite types, it returns an immutable, empty value.
|
||||||
Zero() pref.Value
|
Zero() protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewConverter matches a Go type with a protobuf field and returns a Converter
|
// NewConverter matches a Go type with a protobuf field and returns a Converter
|
||||||
|
|
@ -50,7 +50,7 @@ type Converter interface {
|
||||||
// This matcher deliberately supports a wider range of Go types than what
|
// This matcher deliberately supports a wider range of Go types than what
|
||||||
// protoc-gen-go historically generated to be able to automatically wrap some
|
// protoc-gen-go historically generated to be able to automatically wrap some
|
||||||
// v1 messages generated by other forks of protoc-gen-go.
|
// v1 messages generated by other forks of protoc-gen-go.
|
||||||
func NewConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {
|
func NewConverter(t reflect.Type, fd protoreflect.FieldDescriptor) Converter {
|
||||||
switch {
|
switch {
|
||||||
case fd.IsList():
|
case fd.IsList():
|
||||||
return newListConverter(t, fd)
|
return newListConverter(t, fd)
|
||||||
|
|
@ -59,7 +59,6 @@ func NewConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {
|
||||||
default:
|
default:
|
||||||
return newSingularConverter(t, fd)
|
return newSingularConverter(t, fd)
|
||||||
}
|
}
|
||||||
panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -76,68 +75,68 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
boolZero = pref.ValueOfBool(false)
|
boolZero = protoreflect.ValueOfBool(false)
|
||||||
int32Zero = pref.ValueOfInt32(0)
|
int32Zero = protoreflect.ValueOfInt32(0)
|
||||||
int64Zero = pref.ValueOfInt64(0)
|
int64Zero = protoreflect.ValueOfInt64(0)
|
||||||
uint32Zero = pref.ValueOfUint32(0)
|
uint32Zero = protoreflect.ValueOfUint32(0)
|
||||||
uint64Zero = pref.ValueOfUint64(0)
|
uint64Zero = protoreflect.ValueOfUint64(0)
|
||||||
float32Zero = pref.ValueOfFloat32(0)
|
float32Zero = protoreflect.ValueOfFloat32(0)
|
||||||
float64Zero = pref.ValueOfFloat64(0)
|
float64Zero = protoreflect.ValueOfFloat64(0)
|
||||||
stringZero = pref.ValueOfString("")
|
stringZero = protoreflect.ValueOfString("")
|
||||||
bytesZero = pref.ValueOfBytes(nil)
|
bytesZero = protoreflect.ValueOfBytes(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
func newSingularConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {
|
func newSingularConverter(t reflect.Type, fd protoreflect.FieldDescriptor) Converter {
|
||||||
defVal := func(fd pref.FieldDescriptor, zero pref.Value) pref.Value {
|
defVal := func(fd protoreflect.FieldDescriptor, zero protoreflect.Value) protoreflect.Value {
|
||||||
if fd.Cardinality() == pref.Repeated {
|
if fd.Cardinality() == protoreflect.Repeated {
|
||||||
// Default isn't defined for repeated fields.
|
// Default isn't defined for repeated fields.
|
||||||
return zero
|
return zero
|
||||||
}
|
}
|
||||||
return fd.Default()
|
return fd.Default()
|
||||||
}
|
}
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if t.Kind() == reflect.Bool {
|
if t.Kind() == reflect.Bool {
|
||||||
return &boolConverter{t, defVal(fd, boolZero)}
|
return &boolConverter{t, defVal(fd, boolZero)}
|
||||||
}
|
}
|
||||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||||
if t.Kind() == reflect.Int32 {
|
if t.Kind() == reflect.Int32 {
|
||||||
return &int32Converter{t, defVal(fd, int32Zero)}
|
return &int32Converter{t, defVal(fd, int32Zero)}
|
||||||
}
|
}
|
||||||
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||||
if t.Kind() == reflect.Int64 {
|
if t.Kind() == reflect.Int64 {
|
||||||
return &int64Converter{t, defVal(fd, int64Zero)}
|
return &int64Converter{t, defVal(fd, int64Zero)}
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||||
if t.Kind() == reflect.Uint32 {
|
if t.Kind() == reflect.Uint32 {
|
||||||
return &uint32Converter{t, defVal(fd, uint32Zero)}
|
return &uint32Converter{t, defVal(fd, uint32Zero)}
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind, pref.Fixed64Kind:
|
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||||
if t.Kind() == reflect.Uint64 {
|
if t.Kind() == reflect.Uint64 {
|
||||||
return &uint64Converter{t, defVal(fd, uint64Zero)}
|
return &uint64Converter{t, defVal(fd, uint64Zero)}
|
||||||
}
|
}
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if t.Kind() == reflect.Float32 {
|
if t.Kind() == reflect.Float32 {
|
||||||
return &float32Converter{t, defVal(fd, float32Zero)}
|
return &float32Converter{t, defVal(fd, float32Zero)}
|
||||||
}
|
}
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if t.Kind() == reflect.Float64 {
|
if t.Kind() == reflect.Float64 {
|
||||||
return &float64Converter{t, defVal(fd, float64Zero)}
|
return &float64Converter{t, defVal(fd, float64Zero)}
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {
|
if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {
|
||||||
return &stringConverter{t, defVal(fd, stringZero)}
|
return &stringConverter{t, defVal(fd, stringZero)}
|
||||||
}
|
}
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {
|
if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {
|
||||||
return &bytesConverter{t, defVal(fd, bytesZero)}
|
return &bytesConverter{t, defVal(fd, bytesZero)}
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
// Handle enums, which must be a named int32 type.
|
// Handle enums, which must be a named int32 type.
|
||||||
if t.Kind() == reflect.Int32 {
|
if t.Kind() == reflect.Int32 {
|
||||||
return newEnumConverter(t, fd)
|
return newEnumConverter(t, fd)
|
||||||
}
|
}
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
return newMessageConverter(t)
|
return newMessageConverter(t)
|
||||||
}
|
}
|
||||||
panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
|
panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
|
||||||
|
|
@ -145,184 +144,184 @@ func newSingularConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {
|
||||||
|
|
||||||
type boolConverter struct {
|
type boolConverter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *boolConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *boolConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfBool(v.Bool())
|
return protoreflect.ValueOfBool(v.Bool())
|
||||||
}
|
}
|
||||||
func (c *boolConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *boolConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(v.Bool()).Convert(c.goType)
|
return reflect.ValueOf(v.Bool()).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *boolConverter) IsValidPB(v pref.Value) bool {
|
func (c *boolConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(bool)
|
_, ok := v.Interface().(bool)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *boolConverter) IsValidGo(v reflect.Value) bool {
|
func (c *boolConverter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *boolConverter) New() pref.Value { return c.def }
|
func (c *boolConverter) New() protoreflect.Value { return c.def }
|
||||||
func (c *boolConverter) Zero() pref.Value { return c.def }
|
func (c *boolConverter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type int32Converter struct {
|
type int32Converter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *int32Converter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *int32Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfInt32(int32(v.Int()))
|
return protoreflect.ValueOfInt32(int32(v.Int()))
|
||||||
}
|
}
|
||||||
func (c *int32Converter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *int32Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(int32(v.Int())).Convert(c.goType)
|
return reflect.ValueOf(int32(v.Int())).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *int32Converter) IsValidPB(v pref.Value) bool {
|
func (c *int32Converter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(int32)
|
_, ok := v.Interface().(int32)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *int32Converter) IsValidGo(v reflect.Value) bool {
|
func (c *int32Converter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *int32Converter) New() pref.Value { return c.def }
|
func (c *int32Converter) New() protoreflect.Value { return c.def }
|
||||||
func (c *int32Converter) Zero() pref.Value { return c.def }
|
func (c *int32Converter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type int64Converter struct {
|
type int64Converter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *int64Converter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *int64Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfInt64(int64(v.Int()))
|
return protoreflect.ValueOfInt64(int64(v.Int()))
|
||||||
}
|
}
|
||||||
func (c *int64Converter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *int64Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(int64(v.Int())).Convert(c.goType)
|
return reflect.ValueOf(int64(v.Int())).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *int64Converter) IsValidPB(v pref.Value) bool {
|
func (c *int64Converter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(int64)
|
_, ok := v.Interface().(int64)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *int64Converter) IsValidGo(v reflect.Value) bool {
|
func (c *int64Converter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *int64Converter) New() pref.Value { return c.def }
|
func (c *int64Converter) New() protoreflect.Value { return c.def }
|
||||||
func (c *int64Converter) Zero() pref.Value { return c.def }
|
func (c *int64Converter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type uint32Converter struct {
|
type uint32Converter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *uint32Converter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *uint32Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfUint32(uint32(v.Uint()))
|
return protoreflect.ValueOfUint32(uint32(v.Uint()))
|
||||||
}
|
}
|
||||||
func (c *uint32Converter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *uint32Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(uint32(v.Uint())).Convert(c.goType)
|
return reflect.ValueOf(uint32(v.Uint())).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *uint32Converter) IsValidPB(v pref.Value) bool {
|
func (c *uint32Converter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(uint32)
|
_, ok := v.Interface().(uint32)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *uint32Converter) IsValidGo(v reflect.Value) bool {
|
func (c *uint32Converter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *uint32Converter) New() pref.Value { return c.def }
|
func (c *uint32Converter) New() protoreflect.Value { return c.def }
|
||||||
func (c *uint32Converter) Zero() pref.Value { return c.def }
|
func (c *uint32Converter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type uint64Converter struct {
|
type uint64Converter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *uint64Converter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *uint64Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfUint64(uint64(v.Uint()))
|
return protoreflect.ValueOfUint64(uint64(v.Uint()))
|
||||||
}
|
}
|
||||||
func (c *uint64Converter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *uint64Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(uint64(v.Uint())).Convert(c.goType)
|
return reflect.ValueOf(uint64(v.Uint())).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *uint64Converter) IsValidPB(v pref.Value) bool {
|
func (c *uint64Converter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(uint64)
|
_, ok := v.Interface().(uint64)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *uint64Converter) IsValidGo(v reflect.Value) bool {
|
func (c *uint64Converter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *uint64Converter) New() pref.Value { return c.def }
|
func (c *uint64Converter) New() protoreflect.Value { return c.def }
|
||||||
func (c *uint64Converter) Zero() pref.Value { return c.def }
|
func (c *uint64Converter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type float32Converter struct {
|
type float32Converter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *float32Converter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *float32Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfFloat32(float32(v.Float()))
|
return protoreflect.ValueOfFloat32(float32(v.Float()))
|
||||||
}
|
}
|
||||||
func (c *float32Converter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *float32Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(float32(v.Float())).Convert(c.goType)
|
return reflect.ValueOf(float32(v.Float())).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *float32Converter) IsValidPB(v pref.Value) bool {
|
func (c *float32Converter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(float32)
|
_, ok := v.Interface().(float32)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *float32Converter) IsValidGo(v reflect.Value) bool {
|
func (c *float32Converter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *float32Converter) New() pref.Value { return c.def }
|
func (c *float32Converter) New() protoreflect.Value { return c.def }
|
||||||
func (c *float32Converter) Zero() pref.Value { return c.def }
|
func (c *float32Converter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type float64Converter struct {
|
type float64Converter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *float64Converter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *float64Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfFloat64(float64(v.Float()))
|
return protoreflect.ValueOfFloat64(float64(v.Float()))
|
||||||
}
|
}
|
||||||
func (c *float64Converter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *float64Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(float64(v.Float())).Convert(c.goType)
|
return reflect.ValueOf(float64(v.Float())).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *float64Converter) IsValidPB(v pref.Value) bool {
|
func (c *float64Converter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(float64)
|
_, ok := v.Interface().(float64)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *float64Converter) IsValidGo(v reflect.Value) bool {
|
func (c *float64Converter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *float64Converter) New() pref.Value { return c.def }
|
func (c *float64Converter) New() protoreflect.Value { return c.def }
|
||||||
func (c *float64Converter) Zero() pref.Value { return c.def }
|
func (c *float64Converter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type stringConverter struct {
|
type stringConverter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *stringConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *stringConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfString(v.Convert(stringType).String())
|
return protoreflect.ValueOfString(v.Convert(stringType).String())
|
||||||
}
|
}
|
||||||
func (c *stringConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *stringConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
// pref.Value.String never panics, so we go through an interface
|
// pref.Value.String never panics, so we go through an interface
|
||||||
// conversion here to check the type.
|
// conversion here to check the type.
|
||||||
s := v.Interface().(string)
|
s := v.Interface().(string)
|
||||||
|
|
@ -331,71 +330,71 @@ func (c *stringConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||||
}
|
}
|
||||||
return reflect.ValueOf(s).Convert(c.goType)
|
return reflect.ValueOf(s).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *stringConverter) IsValidPB(v pref.Value) bool {
|
func (c *stringConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(string)
|
_, ok := v.Interface().(string)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *stringConverter) IsValidGo(v reflect.Value) bool {
|
func (c *stringConverter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *stringConverter) New() pref.Value { return c.def }
|
func (c *stringConverter) New() protoreflect.Value { return c.def }
|
||||||
func (c *stringConverter) Zero() pref.Value { return c.def }
|
func (c *stringConverter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type bytesConverter struct {
|
type bytesConverter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *bytesConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *bytesConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
if c.goType.Kind() == reflect.String && v.Len() == 0 {
|
if c.goType.Kind() == reflect.String && v.Len() == 0 {
|
||||||
return pref.ValueOfBytes(nil) // ensure empty string is []byte(nil)
|
return protoreflect.ValueOfBytes(nil) // ensure empty string is []byte(nil)
|
||||||
}
|
}
|
||||||
return pref.ValueOfBytes(v.Convert(bytesType).Bytes())
|
return protoreflect.ValueOfBytes(v.Convert(bytesType).Bytes())
|
||||||
}
|
}
|
||||||
func (c *bytesConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *bytesConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(v.Bytes()).Convert(c.goType)
|
return reflect.ValueOf(v.Bytes()).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *bytesConverter) IsValidPB(v pref.Value) bool {
|
func (c *bytesConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().([]byte)
|
_, ok := v.Interface().([]byte)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *bytesConverter) IsValidGo(v reflect.Value) bool {
|
func (c *bytesConverter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *bytesConverter) New() pref.Value { return c.def }
|
func (c *bytesConverter) New() protoreflect.Value { return c.def }
|
||||||
func (c *bytesConverter) Zero() pref.Value { return c.def }
|
func (c *bytesConverter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type enumConverter struct {
|
type enumConverter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func newEnumConverter(goType reflect.Type, fd pref.FieldDescriptor) Converter {
|
func newEnumConverter(goType reflect.Type, fd protoreflect.FieldDescriptor) Converter {
|
||||||
var def pref.Value
|
var def protoreflect.Value
|
||||||
if fd.Cardinality() == pref.Repeated {
|
if fd.Cardinality() == protoreflect.Repeated {
|
||||||
def = pref.ValueOfEnum(fd.Enum().Values().Get(0).Number())
|
def = protoreflect.ValueOfEnum(fd.Enum().Values().Get(0).Number())
|
||||||
} else {
|
} else {
|
||||||
def = fd.Default()
|
def = fd.Default()
|
||||||
}
|
}
|
||||||
return &enumConverter{goType, def}
|
return &enumConverter{goType, def}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *enumConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *enumConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfEnum(pref.EnumNumber(v.Int()))
|
return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v.Int()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *enumConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *enumConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(v.Enum()).Convert(c.goType)
|
return reflect.ValueOf(v.Enum()).Convert(c.goType)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *enumConverter) IsValidPB(v pref.Value) bool {
|
func (c *enumConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(pref.EnumNumber)
|
_, ok := v.Interface().(protoreflect.EnumNumber)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -403,11 +402,11 @@ func (c *enumConverter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *enumConverter) New() pref.Value {
|
func (c *enumConverter) New() protoreflect.Value {
|
||||||
return c.def
|
return c.def
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *enumConverter) Zero() pref.Value {
|
func (c *enumConverter) Zero() protoreflect.Value {
|
||||||
return c.def
|
return c.def
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -419,7 +418,7 @@ func newMessageConverter(goType reflect.Type) Converter {
|
||||||
return &messageConverter{goType}
|
return &messageConverter{goType}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *messageConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *messageConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
|
|
@ -430,13 +429,13 @@ func (c *messageConverter) PBValueOf(v reflect.Value) pref.Value {
|
||||||
v = reflect.Zero(reflect.PtrTo(v.Type()))
|
v = reflect.Zero(reflect.PtrTo(v.Type()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if m, ok := v.Interface().(pref.ProtoMessage); ok {
|
if m, ok := v.Interface().(protoreflect.ProtoMessage); ok {
|
||||||
return pref.ValueOfMessage(m.ProtoReflect())
|
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||||
}
|
}
|
||||||
return pref.ValueOfMessage(legacyWrapMessage(v))
|
return protoreflect.ValueOfMessage(legacyWrapMessage(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *messageConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *messageConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
m := v.Message()
|
m := v.Message()
|
||||||
var rv reflect.Value
|
var rv reflect.Value
|
||||||
if u, ok := m.(unwrapper); ok {
|
if u, ok := m.(unwrapper); ok {
|
||||||
|
|
@ -460,7 +459,7 @@ func (c *messageConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||||
return rv
|
return rv
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *messageConverter) IsValidPB(v pref.Value) bool {
|
func (c *messageConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
m := v.Message()
|
m := v.Message()
|
||||||
var rv reflect.Value
|
var rv reflect.Value
|
||||||
if u, ok := m.(unwrapper); ok {
|
if u, ok := m.(unwrapper); ok {
|
||||||
|
|
@ -478,14 +477,14 @@ func (c *messageConverter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *messageConverter) New() pref.Value {
|
func (c *messageConverter) New() protoreflect.Value {
|
||||||
if c.isNonPointer() {
|
if c.isNonPointer() {
|
||||||
return c.PBValueOf(reflect.New(c.goType).Elem())
|
return c.PBValueOf(reflect.New(c.goType).Elem())
|
||||||
}
|
}
|
||||||
return c.PBValueOf(reflect.New(c.goType.Elem()))
|
return c.PBValueOf(reflect.New(c.goType.Elem()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *messageConverter) Zero() pref.Value {
|
func (c *messageConverter) Zero() protoreflect.Value {
|
||||||
return c.PBValueOf(reflect.Zero(c.goType))
|
return c.PBValueOf(reflect.Zero(c.goType))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
42
vendor/google.golang.org/protobuf/internal/impl/convert_list.go
generated
vendored
42
vendor/google.golang.org/protobuf/internal/impl/convert_list.go
generated
vendored
|
|
@ -8,10 +8,10 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newListConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {
|
func newListConverter(t reflect.Type, fd protoreflect.FieldDescriptor) Converter {
|
||||||
switch {
|
switch {
|
||||||
case t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Slice:
|
case t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Slice:
|
||||||
return &listPtrConverter{t, newSingularConverter(t.Elem().Elem(), fd)}
|
return &listPtrConverter{t, newSingularConverter(t.Elem().Elem(), fd)}
|
||||||
|
|
@ -26,16 +26,16 @@ type listConverter struct {
|
||||||
c Converter
|
c Converter
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *listConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
pv := reflect.New(c.goType)
|
pv := reflect.New(c.goType)
|
||||||
pv.Elem().Set(v)
|
pv.Elem().Set(v)
|
||||||
return pref.ValueOfList(&listReflect{pv, c.c})
|
return protoreflect.ValueOfList(&listReflect{pv, c.c})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *listConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
rv := v.List().(*listReflect).v
|
rv := v.List().(*listReflect).v
|
||||||
if rv.IsNil() {
|
if rv.IsNil() {
|
||||||
return reflect.Zero(c.goType)
|
return reflect.Zero(c.goType)
|
||||||
|
|
@ -43,7 +43,7 @@ func (c *listConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||||
return rv.Elem()
|
return rv.Elem()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listConverter) IsValidPB(v pref.Value) bool {
|
func (c *listConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
list, ok := v.Interface().(*listReflect)
|
list, ok := v.Interface().(*listReflect)
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
|
|
@ -55,12 +55,12 @@ func (c *listConverter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listConverter) New() pref.Value {
|
func (c *listConverter) New() protoreflect.Value {
|
||||||
return pref.ValueOfList(&listReflect{reflect.New(c.goType), c.c})
|
return protoreflect.ValueOfList(&listReflect{reflect.New(c.goType), c.c})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listConverter) Zero() pref.Value {
|
func (c *listConverter) Zero() protoreflect.Value {
|
||||||
return pref.ValueOfList(&listReflect{reflect.Zero(reflect.PtrTo(c.goType)), c.c})
|
return protoreflect.ValueOfList(&listReflect{reflect.Zero(reflect.PtrTo(c.goType)), c.c})
|
||||||
}
|
}
|
||||||
|
|
||||||
type listPtrConverter struct {
|
type listPtrConverter struct {
|
||||||
|
|
@ -68,18 +68,18 @@ type listPtrConverter struct {
|
||||||
c Converter
|
c Converter
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listPtrConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *listPtrConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfList(&listReflect{v, c.c})
|
return protoreflect.ValueOfList(&listReflect{v, c.c})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listPtrConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *listPtrConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return v.List().(*listReflect).v
|
return v.List().(*listReflect).v
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listPtrConverter) IsValidPB(v pref.Value) bool {
|
func (c *listPtrConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
list, ok := v.Interface().(*listReflect)
|
list, ok := v.Interface().(*listReflect)
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
|
|
@ -91,11 +91,11 @@ func (c *listPtrConverter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listPtrConverter) New() pref.Value {
|
func (c *listPtrConverter) New() protoreflect.Value {
|
||||||
return c.PBValueOf(reflect.New(c.goType.Elem()))
|
return c.PBValueOf(reflect.New(c.goType.Elem()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listPtrConverter) Zero() pref.Value {
|
func (c *listPtrConverter) Zero() protoreflect.Value {
|
||||||
return c.PBValueOf(reflect.Zero(c.goType))
|
return c.PBValueOf(reflect.Zero(c.goType))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,16 +110,16 @@ func (ls *listReflect) Len() int {
|
||||||
}
|
}
|
||||||
return ls.v.Elem().Len()
|
return ls.v.Elem().Len()
|
||||||
}
|
}
|
||||||
func (ls *listReflect) Get(i int) pref.Value {
|
func (ls *listReflect) Get(i int) protoreflect.Value {
|
||||||
return ls.conv.PBValueOf(ls.v.Elem().Index(i))
|
return ls.conv.PBValueOf(ls.v.Elem().Index(i))
|
||||||
}
|
}
|
||||||
func (ls *listReflect) Set(i int, v pref.Value) {
|
func (ls *listReflect) Set(i int, v protoreflect.Value) {
|
||||||
ls.v.Elem().Index(i).Set(ls.conv.GoValueOf(v))
|
ls.v.Elem().Index(i).Set(ls.conv.GoValueOf(v))
|
||||||
}
|
}
|
||||||
func (ls *listReflect) Append(v pref.Value) {
|
func (ls *listReflect) Append(v protoreflect.Value) {
|
||||||
ls.v.Elem().Set(reflect.Append(ls.v.Elem(), ls.conv.GoValueOf(v)))
|
ls.v.Elem().Set(reflect.Append(ls.v.Elem(), ls.conv.GoValueOf(v)))
|
||||||
}
|
}
|
||||||
func (ls *listReflect) AppendMutable() pref.Value {
|
func (ls *listReflect) AppendMutable() protoreflect.Value {
|
||||||
if _, ok := ls.conv.(*messageConverter); !ok {
|
if _, ok := ls.conv.(*messageConverter); !ok {
|
||||||
panic("invalid AppendMutable on list with non-message type")
|
panic("invalid AppendMutable on list with non-message type")
|
||||||
}
|
}
|
||||||
|
|
@ -130,7 +130,7 @@ func (ls *listReflect) AppendMutable() pref.Value {
|
||||||
func (ls *listReflect) Truncate(i int) {
|
func (ls *listReflect) Truncate(i int) {
|
||||||
ls.v.Elem().Set(ls.v.Elem().Slice(0, i))
|
ls.v.Elem().Set(ls.v.Elem().Slice(0, i))
|
||||||
}
|
}
|
||||||
func (ls *listReflect) NewElement() pref.Value {
|
func (ls *listReflect) NewElement() protoreflect.Value {
|
||||||
return ls.conv.New()
|
return ls.conv.New()
|
||||||
}
|
}
|
||||||
func (ls *listReflect) IsValid() bool {
|
func (ls *listReflect) IsValid() bool {
|
||||||
|
|
|
||||||
32
vendor/google.golang.org/protobuf/internal/impl/convert_map.go
generated
vendored
32
vendor/google.golang.org/protobuf/internal/impl/convert_map.go
generated
vendored
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mapConverter struct {
|
type mapConverter struct {
|
||||||
|
|
@ -16,7 +16,7 @@ type mapConverter struct {
|
||||||
keyConv, valConv Converter
|
keyConv, valConv Converter
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMapConverter(t reflect.Type, fd pref.FieldDescriptor) *mapConverter {
|
func newMapConverter(t reflect.Type, fd protoreflect.FieldDescriptor) *mapConverter {
|
||||||
if t.Kind() != reflect.Map {
|
if t.Kind() != reflect.Map {
|
||||||
panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
|
panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
|
||||||
}
|
}
|
||||||
|
|
@ -27,18 +27,18 @@ func newMapConverter(t reflect.Type, fd pref.FieldDescriptor) *mapConverter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mapConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *mapConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfMap(&mapReflect{v, c.keyConv, c.valConv})
|
return protoreflect.ValueOfMap(&mapReflect{v, c.keyConv, c.valConv})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mapConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *mapConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return v.Map().(*mapReflect).v
|
return v.Map().(*mapReflect).v
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mapConverter) IsValidPB(v pref.Value) bool {
|
func (c *mapConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
mapv, ok := v.Interface().(*mapReflect)
|
mapv, ok := v.Interface().(*mapReflect)
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
|
|
@ -50,11 +50,11 @@ func (c *mapConverter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mapConverter) New() pref.Value {
|
func (c *mapConverter) New() protoreflect.Value {
|
||||||
return c.PBValueOf(reflect.MakeMap(c.goType))
|
return c.PBValueOf(reflect.MakeMap(c.goType))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mapConverter) Zero() pref.Value {
|
func (c *mapConverter) Zero() protoreflect.Value {
|
||||||
return c.PBValueOf(reflect.Zero(c.goType))
|
return c.PBValueOf(reflect.Zero(c.goType))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,29 +67,29 @@ type mapReflect struct {
|
||||||
func (ms *mapReflect) Len() int {
|
func (ms *mapReflect) Len() int {
|
||||||
return ms.v.Len()
|
return ms.v.Len()
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) Has(k pref.MapKey) bool {
|
func (ms *mapReflect) Has(k protoreflect.MapKey) bool {
|
||||||
rk := ms.keyConv.GoValueOf(k.Value())
|
rk := ms.keyConv.GoValueOf(k.Value())
|
||||||
rv := ms.v.MapIndex(rk)
|
rv := ms.v.MapIndex(rk)
|
||||||
return rv.IsValid()
|
return rv.IsValid()
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) Get(k pref.MapKey) pref.Value {
|
func (ms *mapReflect) Get(k protoreflect.MapKey) protoreflect.Value {
|
||||||
rk := ms.keyConv.GoValueOf(k.Value())
|
rk := ms.keyConv.GoValueOf(k.Value())
|
||||||
rv := ms.v.MapIndex(rk)
|
rv := ms.v.MapIndex(rk)
|
||||||
if !rv.IsValid() {
|
if !rv.IsValid() {
|
||||||
return pref.Value{}
|
return protoreflect.Value{}
|
||||||
}
|
}
|
||||||
return ms.valConv.PBValueOf(rv)
|
return ms.valConv.PBValueOf(rv)
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) Set(k pref.MapKey, v pref.Value) {
|
func (ms *mapReflect) Set(k protoreflect.MapKey, v protoreflect.Value) {
|
||||||
rk := ms.keyConv.GoValueOf(k.Value())
|
rk := ms.keyConv.GoValueOf(k.Value())
|
||||||
rv := ms.valConv.GoValueOf(v)
|
rv := ms.valConv.GoValueOf(v)
|
||||||
ms.v.SetMapIndex(rk, rv)
|
ms.v.SetMapIndex(rk, rv)
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) Clear(k pref.MapKey) {
|
func (ms *mapReflect) Clear(k protoreflect.MapKey) {
|
||||||
rk := ms.keyConv.GoValueOf(k.Value())
|
rk := ms.keyConv.GoValueOf(k.Value())
|
||||||
ms.v.SetMapIndex(rk, reflect.Value{})
|
ms.v.SetMapIndex(rk, reflect.Value{})
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) Mutable(k pref.MapKey) pref.Value {
|
func (ms *mapReflect) Mutable(k protoreflect.MapKey) protoreflect.Value {
|
||||||
if _, ok := ms.valConv.(*messageConverter); !ok {
|
if _, ok := ms.valConv.(*messageConverter); !ok {
|
||||||
panic("invalid Mutable on map with non-message value type")
|
panic("invalid Mutable on map with non-message value type")
|
||||||
}
|
}
|
||||||
|
|
@ -100,7 +100,7 @@ func (ms *mapReflect) Mutable(k pref.MapKey) pref.Value {
|
||||||
}
|
}
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) Range(f func(pref.MapKey, pref.Value) bool) {
|
func (ms *mapReflect) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) {
|
||||||
iter := mapRange(ms.v)
|
iter := mapRange(ms.v)
|
||||||
for iter.Next() {
|
for iter.Next() {
|
||||||
k := ms.keyConv.PBValueOf(iter.Key()).MapKey()
|
k := ms.keyConv.PBValueOf(iter.Key()).MapKey()
|
||||||
|
|
@ -110,7 +110,7 @@ func (ms *mapReflect) Range(f func(pref.MapKey, pref.Value) bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) NewValue() pref.Value {
|
func (ms *mapReflect) NewValue() protoreflect.Value {
|
||||||
return ms.valConv.New()
|
return ms.valConv.New()
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) IsValid() bool {
|
func (ms *mapReflect) IsValid() bool {
|
||||||
|
|
|
||||||
29
vendor/google.golang.org/protobuf/internal/impl/decode.go
generated
vendored
29
vendor/google.golang.org/protobuf/internal/impl/decode.go
generated
vendored
|
|
@ -12,12 +12,12 @@ import (
|
||||||
"google.golang.org/protobuf/internal/flags"
|
"google.golang.org/protobuf/internal/flags"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
"google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var errDecode = errors.New("cannot parse invalid wire-format data")
|
var errDecode = errors.New("cannot parse invalid wire-format data")
|
||||||
|
var errRecursionDepth = errors.New("exceeded maximum recursion depth")
|
||||||
|
|
||||||
type unmarshalOptions struct {
|
type unmarshalOptions struct {
|
||||||
flags protoiface.UnmarshalInputFlags
|
flags protoiface.UnmarshalInputFlags
|
||||||
|
|
@ -25,6 +25,7 @@ type unmarshalOptions struct {
|
||||||
FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
|
FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
|
||||||
FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
|
FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
|
||||||
}
|
}
|
||||||
|
depth int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o unmarshalOptions) Options() proto.UnmarshalOptions {
|
func (o unmarshalOptions) Options() proto.UnmarshalOptions {
|
||||||
|
|
@ -36,14 +37,17 @@ func (o unmarshalOptions) Options() proto.UnmarshalOptions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o unmarshalOptions) DiscardUnknown() bool { return o.flags&piface.UnmarshalDiscardUnknown != 0 }
|
func (o unmarshalOptions) DiscardUnknown() bool {
|
||||||
|
return o.flags&protoiface.UnmarshalDiscardUnknown != 0
|
||||||
|
}
|
||||||
|
|
||||||
func (o unmarshalOptions) IsDefault() bool {
|
func (o unmarshalOptions) IsDefault() bool {
|
||||||
return o.flags == 0 && o.resolver == preg.GlobalTypes
|
return o.flags == 0 && o.resolver == protoregistry.GlobalTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
var lazyUnmarshalOptions = unmarshalOptions{
|
var lazyUnmarshalOptions = unmarshalOptions{
|
||||||
resolver: preg.GlobalTypes,
|
resolver: protoregistry.GlobalTypes,
|
||||||
|
depth: protowire.DefaultRecursionLimit,
|
||||||
}
|
}
|
||||||
|
|
||||||
type unmarshalOutput struct {
|
type unmarshalOutput struct {
|
||||||
|
|
@ -52,7 +56,7 @@ type unmarshalOutput struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// unmarshal is protoreflect.Methods.Unmarshal.
|
// unmarshal is protoreflect.Methods.Unmarshal.
|
||||||
func (mi *MessageInfo) unmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) {
|
func (mi *MessageInfo) unmarshal(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||||
var p pointer
|
var p pointer
|
||||||
if ms, ok := in.Message.(*messageState); ok {
|
if ms, ok := in.Message.(*messageState); ok {
|
||||||
p = ms.pointer()
|
p = ms.pointer()
|
||||||
|
|
@ -62,12 +66,13 @@ func (mi *MessageInfo) unmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutp
|
||||||
out, err := mi.unmarshalPointer(in.Buf, p, 0, unmarshalOptions{
|
out, err := mi.unmarshalPointer(in.Buf, p, 0, unmarshalOptions{
|
||||||
flags: in.Flags,
|
flags: in.Flags,
|
||||||
resolver: in.Resolver,
|
resolver: in.Resolver,
|
||||||
|
depth: in.Depth,
|
||||||
})
|
})
|
||||||
var flags piface.UnmarshalOutputFlags
|
var flags protoiface.UnmarshalOutputFlags
|
||||||
if out.initialized {
|
if out.initialized {
|
||||||
flags |= piface.UnmarshalInitialized
|
flags |= protoiface.UnmarshalInitialized
|
||||||
}
|
}
|
||||||
return piface.UnmarshalOutput{
|
return protoiface.UnmarshalOutput{
|
||||||
Flags: flags,
|
Flags: flags,
|
||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
@ -82,6 +87,10 @@ var errUnknown = errors.New("unknown")
|
||||||
|
|
||||||
func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
mi.init()
|
mi.init()
|
||||||
|
opts.depth--
|
||||||
|
if opts.depth < 0 {
|
||||||
|
return out, errRecursionDepth
|
||||||
|
}
|
||||||
if flags.ProtoLegacy && mi.isMessageSet {
|
if flags.ProtoLegacy && mi.isMessageSet {
|
||||||
return unmarshalMessageSet(mi, b, p, opts)
|
return unmarshalMessageSet(mi, b, p, opts)
|
||||||
}
|
}
|
||||||
|
|
@ -202,7 +211,7 @@ func (mi *MessageInfo) unmarshalExtension(b []byte, num protowire.Number, wtyp p
|
||||||
var err error
|
var err error
|
||||||
xt, err = opts.resolver.FindExtensionByNumber(mi.Desc.FullName(), num)
|
xt, err = opts.resolver.FindExtensionByNumber(mi.Desc.FullName(), num)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == preg.NotFound {
|
if err == protoregistry.NotFound {
|
||||||
return out, errUnknown
|
return out, errUnknown
|
||||||
}
|
}
|
||||||
return out, errors.New("%v: unable to resolve extension %v: %v", mi.Desc.FullName(), num, err)
|
return out, errors.New("%v: unable to resolve extension %v: %v", mi.Desc.FullName(), num, err)
|
||||||
|
|
|
||||||
10
vendor/google.golang.org/protobuf/internal/impl/enum.go
generated
vendored
10
vendor/google.golang.org/protobuf/internal/impl/enum.go
generated
vendored
|
|
@ -7,15 +7,15 @@ package impl
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type EnumInfo struct {
|
type EnumInfo struct {
|
||||||
GoReflectType reflect.Type // int32 kind
|
GoReflectType reflect.Type // int32 kind
|
||||||
Desc pref.EnumDescriptor
|
Desc protoreflect.EnumDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *EnumInfo) New(n pref.EnumNumber) pref.Enum {
|
func (t *EnumInfo) New(n protoreflect.EnumNumber) protoreflect.Enum {
|
||||||
return reflect.ValueOf(n).Convert(t.GoReflectType).Interface().(pref.Enum)
|
return reflect.ValueOf(n).Convert(t.GoReflectType).Interface().(protoreflect.Enum)
|
||||||
}
|
}
|
||||||
func (t *EnumInfo) Descriptor() pref.EnumDescriptor { return t.Desc }
|
func (t *EnumInfo) Descriptor() protoreflect.EnumDescriptor { return t.Desc }
|
||||||
|
|
|
||||||
26
vendor/google.golang.org/protobuf/internal/impl/extension.go
generated
vendored
26
vendor/google.golang.org/protobuf/internal/impl/extension.go
generated
vendored
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExtensionInfo implements ExtensionType.
|
// ExtensionInfo implements ExtensionType.
|
||||||
|
|
@ -45,7 +45,7 @@ type ExtensionInfo struct {
|
||||||
// since the message may no longer implement the MessageV1 interface.
|
// since the message may no longer implement the MessageV1 interface.
|
||||||
//
|
//
|
||||||
// Deprecated: Use the ExtendedType method instead.
|
// Deprecated: Use the ExtendedType method instead.
|
||||||
ExtendedType piface.MessageV1
|
ExtendedType protoiface.MessageV1
|
||||||
|
|
||||||
// ExtensionType is the zero value of the extension type.
|
// ExtensionType is the zero value of the extension type.
|
||||||
//
|
//
|
||||||
|
|
@ -83,31 +83,31 @@ const (
|
||||||
extensionInfoFullInit = 2
|
extensionInfoFullInit = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
func InitExtensionInfo(xi *ExtensionInfo, xd pref.ExtensionDescriptor, goType reflect.Type) {
|
func InitExtensionInfo(xi *ExtensionInfo, xd protoreflect.ExtensionDescriptor, goType reflect.Type) {
|
||||||
xi.goType = goType
|
xi.goType = goType
|
||||||
xi.desc = extensionTypeDescriptor{xd, xi}
|
xi.desc = extensionTypeDescriptor{xd, xi}
|
||||||
xi.init = extensionInfoDescInit
|
xi.init = extensionInfoDescInit
|
||||||
}
|
}
|
||||||
|
|
||||||
func (xi *ExtensionInfo) New() pref.Value {
|
func (xi *ExtensionInfo) New() protoreflect.Value {
|
||||||
return xi.lazyInit().New()
|
return xi.lazyInit().New()
|
||||||
}
|
}
|
||||||
func (xi *ExtensionInfo) Zero() pref.Value {
|
func (xi *ExtensionInfo) Zero() protoreflect.Value {
|
||||||
return xi.lazyInit().Zero()
|
return xi.lazyInit().Zero()
|
||||||
}
|
}
|
||||||
func (xi *ExtensionInfo) ValueOf(v interface{}) pref.Value {
|
func (xi *ExtensionInfo) ValueOf(v interface{}) protoreflect.Value {
|
||||||
return xi.lazyInit().PBValueOf(reflect.ValueOf(v))
|
return xi.lazyInit().PBValueOf(reflect.ValueOf(v))
|
||||||
}
|
}
|
||||||
func (xi *ExtensionInfo) InterfaceOf(v pref.Value) interface{} {
|
func (xi *ExtensionInfo) InterfaceOf(v protoreflect.Value) interface{} {
|
||||||
return xi.lazyInit().GoValueOf(v).Interface()
|
return xi.lazyInit().GoValueOf(v).Interface()
|
||||||
}
|
}
|
||||||
func (xi *ExtensionInfo) IsValidValue(v pref.Value) bool {
|
func (xi *ExtensionInfo) IsValidValue(v protoreflect.Value) bool {
|
||||||
return xi.lazyInit().IsValidPB(v)
|
return xi.lazyInit().IsValidPB(v)
|
||||||
}
|
}
|
||||||
func (xi *ExtensionInfo) IsValidInterface(v interface{}) bool {
|
func (xi *ExtensionInfo) IsValidInterface(v interface{}) bool {
|
||||||
return xi.lazyInit().IsValidGo(reflect.ValueOf(v))
|
return xi.lazyInit().IsValidGo(reflect.ValueOf(v))
|
||||||
}
|
}
|
||||||
func (xi *ExtensionInfo) TypeDescriptor() pref.ExtensionTypeDescriptor {
|
func (xi *ExtensionInfo) TypeDescriptor() protoreflect.ExtensionTypeDescriptor {
|
||||||
if atomic.LoadUint32(&xi.init) < extensionInfoDescInit {
|
if atomic.LoadUint32(&xi.init) < extensionInfoDescInit {
|
||||||
xi.lazyInitSlow()
|
xi.lazyInitSlow()
|
||||||
}
|
}
|
||||||
|
|
@ -144,13 +144,13 @@ func (xi *ExtensionInfo) lazyInitSlow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
type extensionTypeDescriptor struct {
|
type extensionTypeDescriptor struct {
|
||||||
pref.ExtensionDescriptor
|
protoreflect.ExtensionDescriptor
|
||||||
xi *ExtensionInfo
|
xi *ExtensionInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
func (xtd *extensionTypeDescriptor) Type() pref.ExtensionType {
|
func (xtd *extensionTypeDescriptor) Type() protoreflect.ExtensionType {
|
||||||
return xtd.xi
|
return xtd.xi
|
||||||
}
|
}
|
||||||
func (xtd *extensionTypeDescriptor) Descriptor() pref.ExtensionDescriptor {
|
func (xtd *extensionTypeDescriptor) Descriptor() protoreflect.ExtensionDescriptor {
|
||||||
return xtd.ExtensionDescriptor
|
return xtd.ExtensionDescriptor
|
||||||
}
|
}
|
||||||
|
|
|
||||||
58
vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go
generated
vendored
58
vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go
generated
vendored
|
|
@ -13,13 +13,12 @@ import (
|
||||||
"google.golang.org/protobuf/internal/filedesc"
|
"google.golang.org/protobuf/internal/filedesc"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// legacyEnumName returns the name of enums used in legacy code.
|
// legacyEnumName returns the name of enums used in legacy code.
|
||||||
// It is neither the protobuf full name nor the qualified Go name,
|
// It is neither the protobuf full name nor the qualified Go name,
|
||||||
// but rather an odd hybrid of both.
|
// but rather an odd hybrid of both.
|
||||||
func legacyEnumName(ed pref.EnumDescriptor) string {
|
func legacyEnumName(ed protoreflect.EnumDescriptor) string {
|
||||||
var protoPkg string
|
var protoPkg string
|
||||||
enumName := string(ed.FullName())
|
enumName := string(ed.FullName())
|
||||||
if fd := ed.ParentFile(); fd != nil {
|
if fd := ed.ParentFile(); fd != nil {
|
||||||
|
|
@ -34,68 +33,68 @@ func legacyEnumName(ed pref.EnumDescriptor) string {
|
||||||
|
|
||||||
// legacyWrapEnum wraps v as a protoreflect.Enum,
|
// legacyWrapEnum wraps v as a protoreflect.Enum,
|
||||||
// where v must be a int32 kind and not implement the v2 API already.
|
// where v must be a int32 kind and not implement the v2 API already.
|
||||||
func legacyWrapEnum(v reflect.Value) pref.Enum {
|
func legacyWrapEnum(v reflect.Value) protoreflect.Enum {
|
||||||
et := legacyLoadEnumType(v.Type())
|
et := legacyLoadEnumType(v.Type())
|
||||||
return et.New(pref.EnumNumber(v.Int()))
|
return et.New(protoreflect.EnumNumber(v.Int()))
|
||||||
}
|
}
|
||||||
|
|
||||||
var legacyEnumTypeCache sync.Map // map[reflect.Type]protoreflect.EnumType
|
var legacyEnumTypeCache sync.Map // map[reflect.Type]protoreflect.EnumType
|
||||||
|
|
||||||
// legacyLoadEnumType dynamically loads a protoreflect.EnumType for t,
|
// legacyLoadEnumType dynamically loads a protoreflect.EnumType for t,
|
||||||
// where t must be an int32 kind and not implement the v2 API already.
|
// where t must be an int32 kind and not implement the v2 API already.
|
||||||
func legacyLoadEnumType(t reflect.Type) pref.EnumType {
|
func legacyLoadEnumType(t reflect.Type) protoreflect.EnumType {
|
||||||
// Fast-path: check if a EnumType is cached for this concrete type.
|
// Fast-path: check if a EnumType is cached for this concrete type.
|
||||||
if et, ok := legacyEnumTypeCache.Load(t); ok {
|
if et, ok := legacyEnumTypeCache.Load(t); ok {
|
||||||
return et.(pref.EnumType)
|
return et.(protoreflect.EnumType)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slow-path: derive enum descriptor and initialize EnumType.
|
// Slow-path: derive enum descriptor and initialize EnumType.
|
||||||
var et pref.EnumType
|
var et protoreflect.EnumType
|
||||||
ed := LegacyLoadEnumDesc(t)
|
ed := LegacyLoadEnumDesc(t)
|
||||||
et = &legacyEnumType{
|
et = &legacyEnumType{
|
||||||
desc: ed,
|
desc: ed,
|
||||||
goType: t,
|
goType: t,
|
||||||
}
|
}
|
||||||
if et, ok := legacyEnumTypeCache.LoadOrStore(t, et); ok {
|
if et, ok := legacyEnumTypeCache.LoadOrStore(t, et); ok {
|
||||||
return et.(pref.EnumType)
|
return et.(protoreflect.EnumType)
|
||||||
}
|
}
|
||||||
return et
|
return et
|
||||||
}
|
}
|
||||||
|
|
||||||
type legacyEnumType struct {
|
type legacyEnumType struct {
|
||||||
desc pref.EnumDescriptor
|
desc protoreflect.EnumDescriptor
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
m sync.Map // map[protoreflect.EnumNumber]proto.Enum
|
m sync.Map // map[protoreflect.EnumNumber]proto.Enum
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *legacyEnumType) New(n pref.EnumNumber) pref.Enum {
|
func (t *legacyEnumType) New(n protoreflect.EnumNumber) protoreflect.Enum {
|
||||||
if e, ok := t.m.Load(n); ok {
|
if e, ok := t.m.Load(n); ok {
|
||||||
return e.(pref.Enum)
|
return e.(protoreflect.Enum)
|
||||||
}
|
}
|
||||||
e := &legacyEnumWrapper{num: n, pbTyp: t, goTyp: t.goType}
|
e := &legacyEnumWrapper{num: n, pbTyp: t, goTyp: t.goType}
|
||||||
t.m.Store(n, e)
|
t.m.Store(n, e)
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
func (t *legacyEnumType) Descriptor() pref.EnumDescriptor {
|
func (t *legacyEnumType) Descriptor() protoreflect.EnumDescriptor {
|
||||||
return t.desc
|
return t.desc
|
||||||
}
|
}
|
||||||
|
|
||||||
type legacyEnumWrapper struct {
|
type legacyEnumWrapper struct {
|
||||||
num pref.EnumNumber
|
num protoreflect.EnumNumber
|
||||||
pbTyp pref.EnumType
|
pbTyp protoreflect.EnumType
|
||||||
goTyp reflect.Type
|
goTyp reflect.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *legacyEnumWrapper) Descriptor() pref.EnumDescriptor {
|
func (e *legacyEnumWrapper) Descriptor() protoreflect.EnumDescriptor {
|
||||||
return e.pbTyp.Descriptor()
|
return e.pbTyp.Descriptor()
|
||||||
}
|
}
|
||||||
func (e *legacyEnumWrapper) Type() pref.EnumType {
|
func (e *legacyEnumWrapper) Type() protoreflect.EnumType {
|
||||||
return e.pbTyp
|
return e.pbTyp
|
||||||
}
|
}
|
||||||
func (e *legacyEnumWrapper) Number() pref.EnumNumber {
|
func (e *legacyEnumWrapper) Number() protoreflect.EnumNumber {
|
||||||
return e.num
|
return e.num
|
||||||
}
|
}
|
||||||
func (e *legacyEnumWrapper) ProtoReflect() pref.Enum {
|
func (e *legacyEnumWrapper) ProtoReflect() protoreflect.Enum {
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
func (e *legacyEnumWrapper) protoUnwrap() interface{} {
|
func (e *legacyEnumWrapper) protoUnwrap() interface{} {
|
||||||
|
|
@ -105,8 +104,8 @@ func (e *legacyEnumWrapper) protoUnwrap() interface{} {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ pref.Enum = (*legacyEnumWrapper)(nil)
|
_ protoreflect.Enum = (*legacyEnumWrapper)(nil)
|
||||||
_ unwrapper = (*legacyEnumWrapper)(nil)
|
_ unwrapper = (*legacyEnumWrapper)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
var legacyEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor
|
var legacyEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor
|
||||||
|
|
@ -115,15 +114,15 @@ var legacyEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor
|
||||||
// which must be an int32 kind and not implement the v2 API already.
|
// which must be an int32 kind and not implement the v2 API already.
|
||||||
//
|
//
|
||||||
// This is exported for testing purposes.
|
// This is exported for testing purposes.
|
||||||
func LegacyLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
func LegacyLoadEnumDesc(t reflect.Type) protoreflect.EnumDescriptor {
|
||||||
// Fast-path: check if an EnumDescriptor is cached for this concrete type.
|
// Fast-path: check if an EnumDescriptor is cached for this concrete type.
|
||||||
if ed, ok := legacyEnumDescCache.Load(t); ok {
|
if ed, ok := legacyEnumDescCache.Load(t); ok {
|
||||||
return ed.(pref.EnumDescriptor)
|
return ed.(protoreflect.EnumDescriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slow-path: initialize EnumDescriptor from the raw descriptor.
|
// Slow-path: initialize EnumDescriptor from the raw descriptor.
|
||||||
ev := reflect.Zero(t).Interface()
|
ev := reflect.Zero(t).Interface()
|
||||||
if _, ok := ev.(pref.Enum); ok {
|
if _, ok := ev.(protoreflect.Enum); ok {
|
||||||
panic(fmt.Sprintf("%v already implements proto.Enum", t))
|
panic(fmt.Sprintf("%v already implements proto.Enum", t))
|
||||||
}
|
}
|
||||||
edV1, ok := ev.(enumV1)
|
edV1, ok := ev.(enumV1)
|
||||||
|
|
@ -132,7 +131,7 @@ func LegacyLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
||||||
}
|
}
|
||||||
b, idxs := edV1.EnumDescriptor()
|
b, idxs := edV1.EnumDescriptor()
|
||||||
|
|
||||||
var ed pref.EnumDescriptor
|
var ed protoreflect.EnumDescriptor
|
||||||
if len(idxs) == 1 {
|
if len(idxs) == 1 {
|
||||||
ed = legacyLoadFileDesc(b).Enums().Get(idxs[0])
|
ed = legacyLoadFileDesc(b).Enums().Get(idxs[0])
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -158,16 +157,17 @@ var aberrantEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescript
|
||||||
// We are unable to use the global enum registry since it is
|
// We are unable to use the global enum registry since it is
|
||||||
// unfortunately keyed by the protobuf full name, which we also do not know.
|
// unfortunately keyed by the protobuf full name, which we also do not know.
|
||||||
// Thus, this produces some bogus enum descriptor based on the Go type name.
|
// Thus, this produces some bogus enum descriptor based on the Go type name.
|
||||||
func aberrantLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
func aberrantLoadEnumDesc(t reflect.Type) protoreflect.EnumDescriptor {
|
||||||
// Fast-path: check if an EnumDescriptor is cached for this concrete type.
|
// Fast-path: check if an EnumDescriptor is cached for this concrete type.
|
||||||
if ed, ok := aberrantEnumDescCache.Load(t); ok {
|
if ed, ok := aberrantEnumDescCache.Load(t); ok {
|
||||||
return ed.(pref.EnumDescriptor)
|
return ed.(protoreflect.EnumDescriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slow-path: construct a bogus, but unique EnumDescriptor.
|
// Slow-path: construct a bogus, but unique EnumDescriptor.
|
||||||
ed := &filedesc.Enum{L2: new(filedesc.EnumL2)}
|
ed := &filedesc.Enum{L2: new(filedesc.EnumL2)}
|
||||||
ed.L0.FullName = AberrantDeriveFullName(t) // e.g., github_com.user.repo.MyEnum
|
ed.L0.FullName = AberrantDeriveFullName(t) // e.g., github_com.user.repo.MyEnum
|
||||||
ed.L0.ParentFile = filedesc.SurrogateProto3
|
ed.L0.ParentFile = filedesc.SurrogateProto3
|
||||||
|
ed.L1.EditionFeatures = ed.L0.ParentFile.L1.EditionFeatures
|
||||||
ed.L2.Values.List = append(ed.L2.Values.List, filedesc.EnumValue{})
|
ed.L2.Values.List = append(ed.L2.Values.List, filedesc.EnumValue{})
|
||||||
|
|
||||||
// TODO: Use the presence of a UnmarshalJSON method to determine proto2?
|
// TODO: Use the presence of a UnmarshalJSON method to determine proto2?
|
||||||
|
|
@ -182,7 +182,7 @@ func aberrantLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
||||||
// An exhaustive query is clearly impractical, but can be best-effort.
|
// An exhaustive query is clearly impractical, but can be best-effort.
|
||||||
|
|
||||||
if ed, ok := aberrantEnumDescCache.LoadOrStore(t, ed); ok {
|
if ed, ok := aberrantEnumDescCache.LoadOrStore(t, ed); ok {
|
||||||
return ed.(pref.EnumDescriptor)
|
return ed.(protoreflect.EnumDescriptor)
|
||||||
}
|
}
|
||||||
return ed
|
return ed
|
||||||
}
|
}
|
||||||
|
|
@ -192,7 +192,7 @@ func aberrantLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
||||||
// It should be sufficiently unique within a program.
|
// It should be sufficiently unique within a program.
|
||||||
//
|
//
|
||||||
// This is exported for testing purposes.
|
// This is exported for testing purposes.
|
||||||
func AberrantDeriveFullName(t reflect.Type) pref.FullName {
|
func AberrantDeriveFullName(t reflect.Type) protoreflect.FullName {
|
||||||
sanitize := func(r rune) rune {
|
sanitize := func(r rune) rune {
|
||||||
switch {
|
switch {
|
||||||
case r == '/':
|
case r == '/':
|
||||||
|
|
@ -215,5 +215,5 @@ func AberrantDeriveFullName(t reflect.Type) pref.FullName {
|
||||||
ss[i] = "x" + s
|
ss[i] = "x" + s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pref.FullName(strings.Join(ss, "."))
|
return protoreflect.FullName(strings.Join(ss, "."))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
vendor/google.golang.org/protobuf/internal/impl/legacy_export.go
generated
vendored
18
vendor/google.golang.org/protobuf/internal/impl/legacy_export.go
generated
vendored
|
|
@ -12,21 +12,21 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
// These functions exist to support exported APIs in generated protobufs.
|
// These functions exist to support exported APIs in generated protobufs.
|
||||||
// While these are deprecated, they cannot be removed for compatibility reasons.
|
// While these are deprecated, they cannot be removed for compatibility reasons.
|
||||||
|
|
||||||
// LegacyEnumName returns the name of enums used in legacy code.
|
// LegacyEnumName returns the name of enums used in legacy code.
|
||||||
func (Export) LegacyEnumName(ed pref.EnumDescriptor) string {
|
func (Export) LegacyEnumName(ed protoreflect.EnumDescriptor) string {
|
||||||
return legacyEnumName(ed)
|
return legacyEnumName(ed)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LegacyMessageTypeOf returns the protoreflect.MessageType for m,
|
// LegacyMessageTypeOf returns the protoreflect.MessageType for m,
|
||||||
// with name used as the message name if necessary.
|
// with name used as the message name if necessary.
|
||||||
func (Export) LegacyMessageTypeOf(m piface.MessageV1, name pref.FullName) pref.MessageType {
|
func (Export) LegacyMessageTypeOf(m protoiface.MessageV1, name protoreflect.FullName) protoreflect.MessageType {
|
||||||
if mv := (Export{}).protoMessageV2Of(m); mv != nil {
|
if mv := (Export{}).protoMessageV2Of(m); mv != nil {
|
||||||
return mv.ProtoReflect().Type()
|
return mv.ProtoReflect().Type()
|
||||||
}
|
}
|
||||||
|
|
@ -36,9 +36,9 @@ func (Export) LegacyMessageTypeOf(m piface.MessageV1, name pref.FullName) pref.M
|
||||||
// UnmarshalJSONEnum unmarshals an enum from a JSON-encoded input.
|
// UnmarshalJSONEnum unmarshals an enum from a JSON-encoded input.
|
||||||
// The input can either be a string representing the enum value by name,
|
// The input can either be a string representing the enum value by name,
|
||||||
// or a number representing the enum number itself.
|
// or a number representing the enum number itself.
|
||||||
func (Export) UnmarshalJSONEnum(ed pref.EnumDescriptor, b []byte) (pref.EnumNumber, error) {
|
func (Export) UnmarshalJSONEnum(ed protoreflect.EnumDescriptor, b []byte) (protoreflect.EnumNumber, error) {
|
||||||
if b[0] == '"' {
|
if b[0] == '"' {
|
||||||
var name pref.Name
|
var name protoreflect.Name
|
||||||
if err := json.Unmarshal(b, &name); err != nil {
|
if err := json.Unmarshal(b, &name); err != nil {
|
||||||
return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b)
|
return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b)
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +48,7 @@ func (Export) UnmarshalJSONEnum(ed pref.EnumDescriptor, b []byte) (pref.EnumNumb
|
||||||
}
|
}
|
||||||
return ev.Number(), nil
|
return ev.Number(), nil
|
||||||
} else {
|
} else {
|
||||||
var num pref.EnumNumber
|
var num protoreflect.EnumNumber
|
||||||
if err := json.Unmarshal(b, &num); err != nil {
|
if err := json.Unmarshal(b, &num); err != nil {
|
||||||
return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b)
|
return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b)
|
||||||
}
|
}
|
||||||
|
|
@ -81,8 +81,8 @@ func (Export) CompressGZIP(in []byte) (out []byte) {
|
||||||
blockHeader[0] = 0x01 // final bit per RFC 1951, section 3.2.3.
|
blockHeader[0] = 0x01 // final bit per RFC 1951, section 3.2.3.
|
||||||
blockSize = len(in)
|
blockSize = len(in)
|
||||||
}
|
}
|
||||||
binary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize)^0x0000)
|
binary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize))
|
||||||
binary.LittleEndian.PutUint16(blockHeader[3:5], uint16(blockSize)^0xffff)
|
binary.LittleEndian.PutUint16(blockHeader[3:5], ^uint16(blockSize))
|
||||||
out = append(out, blockHeader[:]...)
|
out = append(out, blockHeader[:]...)
|
||||||
out = append(out, in[:blockSize]...)
|
out = append(out, in[:blockSize]...)
|
||||||
in = in[blockSize:]
|
in = in[blockSize:]
|
||||||
|
|
|
||||||
102
vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go
generated
vendored
102
vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go
generated
vendored
|
|
@ -12,16 +12,16 @@ import (
|
||||||
ptag "google.golang.org/protobuf/internal/encoding/tag"
|
ptag "google.golang.org/protobuf/internal/encoding/tag"
|
||||||
"google.golang.org/protobuf/internal/filedesc"
|
"google.golang.org/protobuf/internal/filedesc"
|
||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (xi *ExtensionInfo) initToLegacy() {
|
func (xi *ExtensionInfo) initToLegacy() {
|
||||||
xd := xi.desc
|
xd := xi.desc
|
||||||
var parent piface.MessageV1
|
var parent protoiface.MessageV1
|
||||||
messageName := xd.ContainingMessage().FullName()
|
messageName := xd.ContainingMessage().FullName()
|
||||||
if mt, _ := preg.GlobalTypes.FindMessageByName(messageName); mt != nil {
|
if mt, _ := protoregistry.GlobalTypes.FindMessageByName(messageName); mt != nil {
|
||||||
// Create a new parent message and unwrap it if possible.
|
// Create a new parent message and unwrap it if possible.
|
||||||
mv := mt.New().Interface()
|
mv := mt.New().Interface()
|
||||||
t := reflect.TypeOf(mv)
|
t := reflect.TypeOf(mv)
|
||||||
|
|
@ -31,7 +31,7 @@ func (xi *ExtensionInfo) initToLegacy() {
|
||||||
|
|
||||||
// Check whether the message implements the legacy v1 Message interface.
|
// Check whether the message implements the legacy v1 Message interface.
|
||||||
mz := reflect.Zero(t).Interface()
|
mz := reflect.Zero(t).Interface()
|
||||||
if mz, ok := mz.(piface.MessageV1); ok {
|
if mz, ok := mz.(protoiface.MessageV1); ok {
|
||||||
parent = mz
|
parent = mz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +46,7 @@ func (xi *ExtensionInfo) initToLegacy() {
|
||||||
|
|
||||||
// Reconstruct the legacy enum full name.
|
// Reconstruct the legacy enum full name.
|
||||||
var enumName string
|
var enumName string
|
||||||
if xd.Kind() == pref.EnumKind {
|
if xd.Kind() == protoreflect.EnumKind {
|
||||||
enumName = legacyEnumName(xd.Enum())
|
enumName = legacyEnumName(xd.Enum())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,16 +77,16 @@ func (xi *ExtensionInfo) initFromLegacy() {
|
||||||
// field number is specified. In such a case, use a placeholder.
|
// field number is specified. In such a case, use a placeholder.
|
||||||
if xi.ExtendedType == nil || xi.ExtensionType == nil {
|
if xi.ExtendedType == nil || xi.ExtensionType == nil {
|
||||||
xd := placeholderExtension{
|
xd := placeholderExtension{
|
||||||
name: pref.FullName(xi.Name),
|
name: protoreflect.FullName(xi.Name),
|
||||||
number: pref.FieldNumber(xi.Field),
|
number: protoreflect.FieldNumber(xi.Field),
|
||||||
}
|
}
|
||||||
xi.desc = extensionTypeDescriptor{xd, xi}
|
xi.desc = extensionTypeDescriptor{xd, xi}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve enum or message dependencies.
|
// Resolve enum or message dependencies.
|
||||||
var ed pref.EnumDescriptor
|
var ed protoreflect.EnumDescriptor
|
||||||
var md pref.MessageDescriptor
|
var md protoreflect.MessageDescriptor
|
||||||
t := reflect.TypeOf(xi.ExtensionType)
|
t := reflect.TypeOf(xi.ExtensionType)
|
||||||
isOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct
|
isOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct
|
||||||
isRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
|
isRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
|
||||||
|
|
@ -94,18 +94,18 @@ func (xi *ExtensionInfo) initFromLegacy() {
|
||||||
t = t.Elem()
|
t = t.Elem()
|
||||||
}
|
}
|
||||||
switch v := reflect.Zero(t).Interface().(type) {
|
switch v := reflect.Zero(t).Interface().(type) {
|
||||||
case pref.Enum:
|
case protoreflect.Enum:
|
||||||
ed = v.Descriptor()
|
ed = v.Descriptor()
|
||||||
case enumV1:
|
case enumV1:
|
||||||
ed = LegacyLoadEnumDesc(t)
|
ed = LegacyLoadEnumDesc(t)
|
||||||
case pref.ProtoMessage:
|
case protoreflect.ProtoMessage:
|
||||||
md = v.ProtoReflect().Descriptor()
|
md = v.ProtoReflect().Descriptor()
|
||||||
case messageV1:
|
case messageV1:
|
||||||
md = LegacyLoadMessageDesc(t)
|
md = LegacyLoadMessageDesc(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Derive basic field information from the struct tag.
|
// Derive basic field information from the struct tag.
|
||||||
var evs pref.EnumValueDescriptors
|
var evs protoreflect.EnumValueDescriptors
|
||||||
if ed != nil {
|
if ed != nil {
|
||||||
evs = ed.Values()
|
evs = ed.Values()
|
||||||
}
|
}
|
||||||
|
|
@ -114,11 +114,11 @@ func (xi *ExtensionInfo) initFromLegacy() {
|
||||||
// Construct a v2 ExtensionType.
|
// Construct a v2 ExtensionType.
|
||||||
xd := &filedesc.Extension{L2: new(filedesc.ExtensionL2)}
|
xd := &filedesc.Extension{L2: new(filedesc.ExtensionL2)}
|
||||||
xd.L0.ParentFile = filedesc.SurrogateProto2
|
xd.L0.ParentFile = filedesc.SurrogateProto2
|
||||||
xd.L0.FullName = pref.FullName(xi.Name)
|
xd.L0.FullName = protoreflect.FullName(xi.Name)
|
||||||
xd.L1.Number = pref.FieldNumber(xi.Field)
|
xd.L1.Number = protoreflect.FieldNumber(xi.Field)
|
||||||
xd.L1.Cardinality = fd.L1.Cardinality
|
xd.L1.Cardinality = fd.L1.Cardinality
|
||||||
xd.L1.Kind = fd.L1.Kind
|
xd.L1.Kind = fd.L1.Kind
|
||||||
xd.L2.IsPacked = fd.L1.IsPacked
|
xd.L1.EditionFeatures = fd.L1.EditionFeatures
|
||||||
xd.L2.Default = fd.L1.Default
|
xd.L2.Default = fd.L1.Default
|
||||||
xd.L1.Extendee = Export{}.MessageDescriptorOf(xi.ExtendedType)
|
xd.L1.Extendee = Export{}.MessageDescriptorOf(xi.ExtendedType)
|
||||||
xd.L2.Enum = ed
|
xd.L2.Enum = ed
|
||||||
|
|
@ -138,39 +138,39 @@ func (xi *ExtensionInfo) initFromLegacy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
type placeholderExtension struct {
|
type placeholderExtension struct {
|
||||||
name pref.FullName
|
name protoreflect.FullName
|
||||||
number pref.FieldNumber
|
number protoreflect.FieldNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x placeholderExtension) ParentFile() pref.FileDescriptor { return nil }
|
func (x placeholderExtension) ParentFile() protoreflect.FileDescriptor { return nil }
|
||||||
func (x placeholderExtension) Parent() pref.Descriptor { return nil }
|
func (x placeholderExtension) Parent() protoreflect.Descriptor { return nil }
|
||||||
func (x placeholderExtension) Index() int { return 0 }
|
func (x placeholderExtension) Index() int { return 0 }
|
||||||
func (x placeholderExtension) Syntax() pref.Syntax { return 0 }
|
func (x placeholderExtension) Syntax() protoreflect.Syntax { return 0 }
|
||||||
func (x placeholderExtension) Name() pref.Name { return x.name.Name() }
|
func (x placeholderExtension) Name() protoreflect.Name { return x.name.Name() }
|
||||||
func (x placeholderExtension) FullName() pref.FullName { return x.name }
|
func (x placeholderExtension) FullName() protoreflect.FullName { return x.name }
|
||||||
func (x placeholderExtension) IsPlaceholder() bool { return true }
|
func (x placeholderExtension) IsPlaceholder() bool { return true }
|
||||||
func (x placeholderExtension) Options() pref.ProtoMessage { return descopts.Field }
|
func (x placeholderExtension) Options() protoreflect.ProtoMessage { return descopts.Field }
|
||||||
func (x placeholderExtension) Number() pref.FieldNumber { return x.number }
|
func (x placeholderExtension) Number() protoreflect.FieldNumber { return x.number }
|
||||||
func (x placeholderExtension) Cardinality() pref.Cardinality { return 0 }
|
func (x placeholderExtension) Cardinality() protoreflect.Cardinality { return 0 }
|
||||||
func (x placeholderExtension) Kind() pref.Kind { return 0 }
|
func (x placeholderExtension) Kind() protoreflect.Kind { return 0 }
|
||||||
func (x placeholderExtension) HasJSONName() bool { return false }
|
func (x placeholderExtension) HasJSONName() bool { return false }
|
||||||
func (x placeholderExtension) JSONName() string { return "[" + string(x.name) + "]" }
|
func (x placeholderExtension) JSONName() string { return "[" + string(x.name) + "]" }
|
||||||
func (x placeholderExtension) TextName() string { return "[" + string(x.name) + "]" }
|
func (x placeholderExtension) TextName() string { return "[" + string(x.name) + "]" }
|
||||||
func (x placeholderExtension) HasPresence() bool { return false }
|
func (x placeholderExtension) HasPresence() bool { return false }
|
||||||
func (x placeholderExtension) HasOptionalKeyword() bool { return false }
|
func (x placeholderExtension) HasOptionalKeyword() bool { return false }
|
||||||
func (x placeholderExtension) IsExtension() bool { return true }
|
func (x placeholderExtension) IsExtension() bool { return true }
|
||||||
func (x placeholderExtension) IsWeak() bool { return false }
|
func (x placeholderExtension) IsWeak() bool { return false }
|
||||||
func (x placeholderExtension) IsPacked() bool { return false }
|
func (x placeholderExtension) IsPacked() bool { return false }
|
||||||
func (x placeholderExtension) IsList() bool { return false }
|
func (x placeholderExtension) IsList() bool { return false }
|
||||||
func (x placeholderExtension) IsMap() bool { return false }
|
func (x placeholderExtension) IsMap() bool { return false }
|
||||||
func (x placeholderExtension) MapKey() pref.FieldDescriptor { return nil }
|
func (x placeholderExtension) MapKey() protoreflect.FieldDescriptor { return nil }
|
||||||
func (x placeholderExtension) MapValue() pref.FieldDescriptor { return nil }
|
func (x placeholderExtension) MapValue() protoreflect.FieldDescriptor { return nil }
|
||||||
func (x placeholderExtension) HasDefault() bool { return false }
|
func (x placeholderExtension) HasDefault() bool { return false }
|
||||||
func (x placeholderExtension) Default() pref.Value { return pref.Value{} }
|
func (x placeholderExtension) Default() protoreflect.Value { return protoreflect.Value{} }
|
||||||
func (x placeholderExtension) DefaultEnumValue() pref.EnumValueDescriptor { return nil }
|
func (x placeholderExtension) DefaultEnumValue() protoreflect.EnumValueDescriptor { return nil }
|
||||||
func (x placeholderExtension) ContainingOneof() pref.OneofDescriptor { return nil }
|
func (x placeholderExtension) ContainingOneof() protoreflect.OneofDescriptor { return nil }
|
||||||
func (x placeholderExtension) ContainingMessage() pref.MessageDescriptor { return nil }
|
func (x placeholderExtension) ContainingMessage() protoreflect.MessageDescriptor { return nil }
|
||||||
func (x placeholderExtension) Enum() pref.EnumDescriptor { return nil }
|
func (x placeholderExtension) Enum() protoreflect.EnumDescriptor { return nil }
|
||||||
func (x placeholderExtension) Message() pref.MessageDescriptor { return nil }
|
func (x placeholderExtension) Message() protoreflect.MessageDescriptor { return nil }
|
||||||
func (x placeholderExtension) ProtoType(pref.FieldDescriptor) { return }
|
func (x placeholderExtension) ProtoType(protoreflect.FieldDescriptor) { return }
|
||||||
func (x placeholderExtension) ProtoInternal(pragma.DoNotImplement) { return }
|
func (x placeholderExtension) ProtoInternal(pragma.DoNotImplement) { return }
|
||||||
|
|
|
||||||
4
vendor/google.golang.org/protobuf/internal/impl/legacy_file.go
generated
vendored
4
vendor/google.golang.org/protobuf/internal/impl/legacy_file.go
generated
vendored
|
|
@ -7,7 +7,7 @@ package impl
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"google.golang.org/protobuf/internal/filedesc"
|
"google.golang.org/protobuf/internal/filedesc"
|
||||||
|
|
@ -51,7 +51,7 @@ func legacyLoadFileDesc(b []byte) protoreflect.FileDescriptor {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
b2, err := ioutil.ReadAll(zr)
|
b2, err := io.ReadAll(zr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
156
vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
generated
vendored
156
vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
generated
vendored
|
|
@ -16,14 +16,12 @@ import (
|
||||||
"google.golang.org/protobuf/internal/filedesc"
|
"google.golang.org/protobuf/internal/filedesc"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
"google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// legacyWrapMessage wraps v as a protoreflect.Message,
|
// legacyWrapMessage wraps v as a protoreflect.Message,
|
||||||
// where v must be a *struct kind and not implement the v2 API already.
|
// where v must be a *struct kind and not implement the v2 API already.
|
||||||
func legacyWrapMessage(v reflect.Value) pref.Message {
|
func legacyWrapMessage(v reflect.Value) protoreflect.Message {
|
||||||
t := v.Type()
|
t := v.Type()
|
||||||
if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
|
if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
|
||||||
return aberrantMessage{v: v}
|
return aberrantMessage{v: v}
|
||||||
|
|
@ -35,7 +33,7 @@ func legacyWrapMessage(v reflect.Value) pref.Message {
|
||||||
// legacyLoadMessageType dynamically loads a protoreflect.Type for t,
|
// legacyLoadMessageType dynamically loads a protoreflect.Type for t,
|
||||||
// where t must be not implement the v2 API already.
|
// where t must be not implement the v2 API already.
|
||||||
// The provided name is used if it cannot be determined from the message.
|
// The provided name is used if it cannot be determined from the message.
|
||||||
func legacyLoadMessageType(t reflect.Type, name pref.FullName) protoreflect.MessageType {
|
func legacyLoadMessageType(t reflect.Type, name protoreflect.FullName) protoreflect.MessageType {
|
||||||
if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
|
if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
|
||||||
return aberrantMessageType{t}
|
return aberrantMessageType{t}
|
||||||
}
|
}
|
||||||
|
|
@ -47,7 +45,7 @@ var legacyMessageTypeCache sync.Map // map[reflect.Type]*MessageInfo
|
||||||
// legacyLoadMessageInfo dynamically loads a *MessageInfo for t,
|
// legacyLoadMessageInfo dynamically loads a *MessageInfo for t,
|
||||||
// where t must be a *struct kind and not implement the v2 API already.
|
// where t must be a *struct kind and not implement the v2 API already.
|
||||||
// The provided name is used if it cannot be determined from the message.
|
// The provided name is used if it cannot be determined from the message.
|
||||||
func legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo {
|
func legacyLoadMessageInfo(t reflect.Type, name protoreflect.FullName) *MessageInfo {
|
||||||
// Fast-path: check if a MessageInfo is cached for this concrete type.
|
// Fast-path: check if a MessageInfo is cached for this concrete type.
|
||||||
if mt, ok := legacyMessageTypeCache.Load(t); ok {
|
if mt, ok := legacyMessageTypeCache.Load(t); ok {
|
||||||
return mt.(*MessageInfo)
|
return mt.(*MessageInfo)
|
||||||
|
|
@ -68,7 +66,7 @@ func legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo {
|
||||||
// supports deterministic serialization or not, but this
|
// supports deterministic serialization or not, but this
|
||||||
// preserves the v1 implementation's behavior of always
|
// preserves the v1 implementation's behavior of always
|
||||||
// calling Marshal methods when present.
|
// calling Marshal methods when present.
|
||||||
mi.methods.Flags |= piface.SupportMarshalDeterministic
|
mi.methods.Flags |= protoiface.SupportMarshalDeterministic
|
||||||
}
|
}
|
||||||
if _, hasUnmarshal = v.(legacyUnmarshaler); hasUnmarshal {
|
if _, hasUnmarshal = v.(legacyUnmarshaler); hasUnmarshal {
|
||||||
mi.methods.Unmarshal = legacyUnmarshal
|
mi.methods.Unmarshal = legacyUnmarshal
|
||||||
|
|
@ -89,18 +87,18 @@ var legacyMessageDescCache sync.Map // map[reflect.Type]protoreflect.MessageDesc
|
||||||
// which should be a *struct kind and must not implement the v2 API already.
|
// which should be a *struct kind and must not implement the v2 API already.
|
||||||
//
|
//
|
||||||
// This is exported for testing purposes.
|
// This is exported for testing purposes.
|
||||||
func LegacyLoadMessageDesc(t reflect.Type) pref.MessageDescriptor {
|
func LegacyLoadMessageDesc(t reflect.Type) protoreflect.MessageDescriptor {
|
||||||
return legacyLoadMessageDesc(t, "")
|
return legacyLoadMessageDesc(t, "")
|
||||||
}
|
}
|
||||||
func legacyLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor {
|
func legacyLoadMessageDesc(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
|
||||||
// Fast-path: check if a MessageDescriptor is cached for this concrete type.
|
// Fast-path: check if a MessageDescriptor is cached for this concrete type.
|
||||||
if mi, ok := legacyMessageDescCache.Load(t); ok {
|
if mi, ok := legacyMessageDescCache.Load(t); ok {
|
||||||
return mi.(pref.MessageDescriptor)
|
return mi.(protoreflect.MessageDescriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slow-path: initialize MessageDescriptor from the raw descriptor.
|
// Slow-path: initialize MessageDescriptor from the raw descriptor.
|
||||||
mv := reflect.Zero(t).Interface()
|
mv := reflect.Zero(t).Interface()
|
||||||
if _, ok := mv.(pref.ProtoMessage); ok {
|
if _, ok := mv.(protoreflect.ProtoMessage); ok {
|
||||||
panic(fmt.Sprintf("%v already implements proto.Message", t))
|
panic(fmt.Sprintf("%v already implements proto.Message", t))
|
||||||
}
|
}
|
||||||
mdV1, ok := mv.(messageV1)
|
mdV1, ok := mv.(messageV1)
|
||||||
|
|
@ -164,7 +162,7 @@ var (
|
||||||
//
|
//
|
||||||
// This is a best-effort derivation of the message descriptor using the protobuf
|
// This is a best-effort derivation of the message descriptor using the protobuf
|
||||||
// tags on the struct fields.
|
// tags on the struct fields.
|
||||||
func aberrantLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor {
|
func aberrantLoadMessageDesc(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
|
||||||
aberrantMessageDescLock.Lock()
|
aberrantMessageDescLock.Lock()
|
||||||
defer aberrantMessageDescLock.Unlock()
|
defer aberrantMessageDescLock.Unlock()
|
||||||
if aberrantMessageDescCache == nil {
|
if aberrantMessageDescCache == nil {
|
||||||
|
|
@ -172,7 +170,7 @@ func aberrantLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDes
|
||||||
}
|
}
|
||||||
return aberrantLoadMessageDescReentrant(t, name)
|
return aberrantLoadMessageDescReentrant(t, name)
|
||||||
}
|
}
|
||||||
func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.MessageDescriptor {
|
func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
|
||||||
// Fast-path: check if an MessageDescriptor is cached for this concrete type.
|
// Fast-path: check if an MessageDescriptor is cached for this concrete type.
|
||||||
if md, ok := aberrantMessageDescCache[t]; ok {
|
if md, ok := aberrantMessageDescCache[t]; ok {
|
||||||
return md
|
return md
|
||||||
|
|
@ -206,15 +204,21 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.M
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
md.L1.EditionFeatures = md.L0.ParentFile.L1.EditionFeatures
|
||||||
// Obtain a list of oneof wrapper types.
|
// Obtain a list of oneof wrapper types.
|
||||||
var oneofWrappers []reflect.Type
|
var oneofWrappers []reflect.Type
|
||||||
for _, method := range []string{"XXX_OneofFuncs", "XXX_OneofWrappers"} {
|
methods := make([]reflect.Method, 0, 2)
|
||||||
if fn, ok := t.MethodByName(method); ok {
|
if m, ok := t.MethodByName("XXX_OneofFuncs"); ok {
|
||||||
for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {
|
methods = append(methods, m)
|
||||||
if vs, ok := v.Interface().([]interface{}); ok {
|
}
|
||||||
for _, v := range vs {
|
if m, ok := t.MethodByName("XXX_OneofWrappers"); ok {
|
||||||
oneofWrappers = append(oneofWrappers, reflect.TypeOf(v))
|
methods = append(methods, m)
|
||||||
}
|
}
|
||||||
|
for _, fn := range methods {
|
||||||
|
for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {
|
||||||
|
if vs, ok := v.Interface().([]interface{}); ok {
|
||||||
|
for _, v := range vs {
|
||||||
|
oneofWrappers = append(oneofWrappers, reflect.TypeOf(v))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -225,9 +229,9 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.M
|
||||||
vs := fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0]
|
vs := fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0]
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
v := vs.Index(i)
|
v := vs.Index(i)
|
||||||
md.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, [2]pref.FieldNumber{
|
md.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, [2]protoreflect.FieldNumber{
|
||||||
pref.FieldNumber(v.FieldByName("Start").Int()),
|
protoreflect.FieldNumber(v.FieldByName("Start").Int()),
|
||||||
pref.FieldNumber(v.FieldByName("End").Int() + 1),
|
protoreflect.FieldNumber(v.FieldByName("End").Int() + 1),
|
||||||
})
|
})
|
||||||
md.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, nil)
|
md.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, nil)
|
||||||
}
|
}
|
||||||
|
|
@ -245,8 +249,9 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.M
|
||||||
n := len(md.L2.Oneofs.List)
|
n := len(md.L2.Oneofs.List)
|
||||||
md.L2.Oneofs.List = append(md.L2.Oneofs.List, filedesc.Oneof{})
|
md.L2.Oneofs.List = append(md.L2.Oneofs.List, filedesc.Oneof{})
|
||||||
od := &md.L2.Oneofs.List[n]
|
od := &md.L2.Oneofs.List[n]
|
||||||
od.L0.FullName = md.FullName().Append(pref.Name(tag))
|
od.L0.FullName = md.FullName().Append(protoreflect.Name(tag))
|
||||||
od.L0.ParentFile = md.L0.ParentFile
|
od.L0.ParentFile = md.L0.ParentFile
|
||||||
|
od.L1.EditionFeatures = md.L1.EditionFeatures
|
||||||
od.L0.Parent = md
|
od.L0.Parent = md
|
||||||
od.L0.Index = n
|
od.L0.Index = n
|
||||||
|
|
||||||
|
|
@ -257,6 +262,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.M
|
||||||
aberrantAppendField(md, f.Type, tag, "", "")
|
aberrantAppendField(md, f.Type, tag, "", "")
|
||||||
fd := &md.L2.Fields.List[len(md.L2.Fields.List)-1]
|
fd := &md.L2.Fields.List[len(md.L2.Fields.List)-1]
|
||||||
fd.L1.ContainingOneof = od
|
fd.L1.ContainingOneof = od
|
||||||
|
fd.L1.EditionFeatures = od.L1.EditionFeatures
|
||||||
od.L1.Fields.List = append(od.L1.Fields.List, fd)
|
od.L1.Fields.List = append(od.L1.Fields.List, fd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -267,14 +273,14 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.M
|
||||||
return md
|
return md
|
||||||
}
|
}
|
||||||
|
|
||||||
func aberrantDeriveMessageName(t reflect.Type, name pref.FullName) pref.FullName {
|
func aberrantDeriveMessageName(t reflect.Type, name protoreflect.FullName) protoreflect.FullName {
|
||||||
if name.IsValid() {
|
if name.IsValid() {
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
func() {
|
func() {
|
||||||
defer func() { recover() }() // swallow possible nil panics
|
defer func() { recover() }() // swallow possible nil panics
|
||||||
if m, ok := reflect.Zero(t).Interface().(interface{ XXX_MessageName() string }); ok {
|
if m, ok := reflect.Zero(t).Interface().(interface{ XXX_MessageName() string }); ok {
|
||||||
name = pref.FullName(m.XXX_MessageName())
|
name = protoreflect.FullName(m.XXX_MessageName())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if name.IsValid() {
|
if name.IsValid() {
|
||||||
|
|
@ -304,31 +310,31 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey,
|
||||||
fd.L0.Parent = md
|
fd.L0.Parent = md
|
||||||
fd.L0.Index = n
|
fd.L0.Index = n
|
||||||
|
|
||||||
if fd.L1.IsWeak || fd.L1.HasPacked {
|
if fd.L1.IsWeak || fd.L1.EditionFeatures.IsPacked {
|
||||||
fd.L1.Options = func() pref.ProtoMessage {
|
fd.L1.Options = func() protoreflect.ProtoMessage {
|
||||||
opts := descopts.Field.ProtoReflect().New()
|
opts := descopts.Field.ProtoReflect().New()
|
||||||
if fd.L1.IsWeak {
|
if fd.L1.IsWeak {
|
||||||
opts.Set(opts.Descriptor().Fields().ByName("weak"), protoreflect.ValueOfBool(true))
|
opts.Set(opts.Descriptor().Fields().ByName("weak"), protoreflect.ValueOfBool(true))
|
||||||
}
|
}
|
||||||
if fd.L1.HasPacked {
|
if fd.L1.EditionFeatures.IsPacked {
|
||||||
opts.Set(opts.Descriptor().Fields().ByName("packed"), protoreflect.ValueOfBool(fd.L1.IsPacked))
|
opts.Set(opts.Descriptor().Fields().ByName("packed"), protoreflect.ValueOfBool(fd.L1.EditionFeatures.IsPacked))
|
||||||
}
|
}
|
||||||
return opts.Interface()
|
return opts.Interface()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate Enum and Message.
|
// Populate Enum and Message.
|
||||||
if fd.Enum() == nil && fd.Kind() == pref.EnumKind {
|
if fd.Enum() == nil && fd.Kind() == protoreflect.EnumKind {
|
||||||
switch v := reflect.Zero(t).Interface().(type) {
|
switch v := reflect.Zero(t).Interface().(type) {
|
||||||
case pref.Enum:
|
case protoreflect.Enum:
|
||||||
fd.L1.Enum = v.Descriptor()
|
fd.L1.Enum = v.Descriptor()
|
||||||
default:
|
default:
|
||||||
fd.L1.Enum = LegacyLoadEnumDesc(t)
|
fd.L1.Enum = LegacyLoadEnumDesc(t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if fd.Message() == nil && (fd.Kind() == pref.MessageKind || fd.Kind() == pref.GroupKind) {
|
if fd.Message() == nil && (fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind) {
|
||||||
switch v := reflect.Zero(t).Interface().(type) {
|
switch v := reflect.Zero(t).Interface().(type) {
|
||||||
case pref.ProtoMessage:
|
case protoreflect.ProtoMessage:
|
||||||
fd.L1.Message = v.ProtoReflect().Descriptor()
|
fd.L1.Message = v.ProtoReflect().Descriptor()
|
||||||
case messageV1:
|
case messageV1:
|
||||||
fd.L1.Message = LegacyLoadMessageDesc(t)
|
fd.L1.Message = LegacyLoadMessageDesc(t)
|
||||||
|
|
@ -337,13 +343,14 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey,
|
||||||
n := len(md.L1.Messages.List)
|
n := len(md.L1.Messages.List)
|
||||||
md.L1.Messages.List = append(md.L1.Messages.List, filedesc.Message{L2: new(filedesc.MessageL2)})
|
md.L1.Messages.List = append(md.L1.Messages.List, filedesc.Message{L2: new(filedesc.MessageL2)})
|
||||||
md2 := &md.L1.Messages.List[n]
|
md2 := &md.L1.Messages.List[n]
|
||||||
md2.L0.FullName = md.FullName().Append(pref.Name(strs.MapEntryName(string(fd.Name()))))
|
md2.L0.FullName = md.FullName().Append(protoreflect.Name(strs.MapEntryName(string(fd.Name()))))
|
||||||
md2.L0.ParentFile = md.L0.ParentFile
|
md2.L0.ParentFile = md.L0.ParentFile
|
||||||
md2.L0.Parent = md
|
md2.L0.Parent = md
|
||||||
md2.L0.Index = n
|
md2.L0.Index = n
|
||||||
|
md2.L1.EditionFeatures = md.L1.EditionFeatures
|
||||||
|
|
||||||
md2.L1.IsMapEntry = true
|
md2.L1.IsMapEntry = true
|
||||||
md2.L2.Options = func() pref.ProtoMessage {
|
md2.L2.Options = func() protoreflect.ProtoMessage {
|
||||||
opts := descopts.Message.ProtoReflect().New()
|
opts := descopts.Message.ProtoReflect().New()
|
||||||
opts.Set(opts.Descriptor().Fields().ByName("map_entry"), protoreflect.ValueOfBool(true))
|
opts.Set(opts.Descriptor().Fields().ByName("map_entry"), protoreflect.ValueOfBool(true))
|
||||||
return opts.Interface()
|
return opts.Interface()
|
||||||
|
|
@ -364,8 +371,8 @@ type placeholderEnumValues struct {
|
||||||
protoreflect.EnumValueDescriptors
|
protoreflect.EnumValueDescriptors
|
||||||
}
|
}
|
||||||
|
|
||||||
func (placeholderEnumValues) ByNumber(n pref.EnumNumber) pref.EnumValueDescriptor {
|
func (placeholderEnumValues) ByNumber(n protoreflect.EnumNumber) protoreflect.EnumValueDescriptor {
|
||||||
return filedesc.PlaceholderEnumValue(pref.FullName(fmt.Sprintf("UNKNOWN_%d", n)))
|
return filedesc.PlaceholderEnumValue(protoreflect.FullName(fmt.Sprintf("UNKNOWN_%d", n)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// legacyMarshaler is the proto.Marshaler interface superseded by protoiface.Methoder.
|
// legacyMarshaler is the proto.Marshaler interface superseded by protoiface.Methoder.
|
||||||
|
|
@ -383,7 +390,7 @@ type legacyMerger interface {
|
||||||
Merge(protoiface.MessageV1)
|
Merge(protoiface.MessageV1)
|
||||||
}
|
}
|
||||||
|
|
||||||
var aberrantProtoMethods = &piface.Methods{
|
var aberrantProtoMethods = &protoiface.Methods{
|
||||||
Marshal: legacyMarshal,
|
Marshal: legacyMarshal,
|
||||||
Unmarshal: legacyUnmarshal,
|
Unmarshal: legacyUnmarshal,
|
||||||
Merge: legacyMerge,
|
Merge: legacyMerge,
|
||||||
|
|
@ -392,40 +399,40 @@ var aberrantProtoMethods = &piface.Methods{
|
||||||
// supports deterministic serialization or not, but this
|
// supports deterministic serialization or not, but this
|
||||||
// preserves the v1 implementation's behavior of always
|
// preserves the v1 implementation's behavior of always
|
||||||
// calling Marshal methods when present.
|
// calling Marshal methods when present.
|
||||||
Flags: piface.SupportMarshalDeterministic,
|
Flags: protoiface.SupportMarshalDeterministic,
|
||||||
}
|
}
|
||||||
|
|
||||||
func legacyMarshal(in piface.MarshalInput) (piface.MarshalOutput, error) {
|
func legacyMarshal(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
||||||
v := in.Message.(unwrapper).protoUnwrap()
|
v := in.Message.(unwrapper).protoUnwrap()
|
||||||
marshaler, ok := v.(legacyMarshaler)
|
marshaler, ok := v.(legacyMarshaler)
|
||||||
if !ok {
|
if !ok {
|
||||||
return piface.MarshalOutput{}, errors.New("%T does not implement Marshal", v)
|
return protoiface.MarshalOutput{}, errors.New("%T does not implement Marshal", v)
|
||||||
}
|
}
|
||||||
out, err := marshaler.Marshal()
|
out, err := marshaler.Marshal()
|
||||||
if in.Buf != nil {
|
if in.Buf != nil {
|
||||||
out = append(in.Buf, out...)
|
out = append(in.Buf, out...)
|
||||||
}
|
}
|
||||||
return piface.MarshalOutput{
|
return protoiface.MarshalOutput{
|
||||||
Buf: out,
|
Buf: out,
|
||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func legacyUnmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) {
|
func legacyUnmarshal(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||||
v := in.Message.(unwrapper).protoUnwrap()
|
v := in.Message.(unwrapper).protoUnwrap()
|
||||||
unmarshaler, ok := v.(legacyUnmarshaler)
|
unmarshaler, ok := v.(legacyUnmarshaler)
|
||||||
if !ok {
|
if !ok {
|
||||||
return piface.UnmarshalOutput{}, errors.New("%T does not implement Unmarshal", v)
|
return protoiface.UnmarshalOutput{}, errors.New("%T does not implement Unmarshal", v)
|
||||||
}
|
}
|
||||||
return piface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf)
|
return protoiface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
func legacyMerge(in piface.MergeInput) piface.MergeOutput {
|
func legacyMerge(in protoiface.MergeInput) protoiface.MergeOutput {
|
||||||
// Check whether this supports the legacy merger.
|
// Check whether this supports the legacy merger.
|
||||||
dstv := in.Destination.(unwrapper).protoUnwrap()
|
dstv := in.Destination.(unwrapper).protoUnwrap()
|
||||||
merger, ok := dstv.(legacyMerger)
|
merger, ok := dstv.(legacyMerger)
|
||||||
if ok {
|
if ok {
|
||||||
merger.Merge(Export{}.ProtoMessageV1Of(in.Source))
|
merger.Merge(Export{}.ProtoMessageV1Of(in.Source))
|
||||||
return piface.MergeOutput{Flags: piface.MergeComplete}
|
return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If legacy merger is unavailable, implement merge in terms of
|
// If legacy merger is unavailable, implement merge in terms of
|
||||||
|
|
@ -433,22 +440,29 @@ func legacyMerge(in piface.MergeInput) piface.MergeOutput {
|
||||||
srcv := in.Source.(unwrapper).protoUnwrap()
|
srcv := in.Source.(unwrapper).protoUnwrap()
|
||||||
marshaler, ok := srcv.(legacyMarshaler)
|
marshaler, ok := srcv.(legacyMarshaler)
|
||||||
if !ok {
|
if !ok {
|
||||||
return piface.MergeOutput{}
|
return protoiface.MergeOutput{}
|
||||||
}
|
}
|
||||||
dstv = in.Destination.(unwrapper).protoUnwrap()
|
dstv = in.Destination.(unwrapper).protoUnwrap()
|
||||||
unmarshaler, ok := dstv.(legacyUnmarshaler)
|
unmarshaler, ok := dstv.(legacyUnmarshaler)
|
||||||
if !ok {
|
if !ok {
|
||||||
return piface.MergeOutput{}
|
return protoiface.MergeOutput{}
|
||||||
|
}
|
||||||
|
if !in.Source.IsValid() {
|
||||||
|
// Legacy Marshal methods may not function on nil messages.
|
||||||
|
// Check for a typed nil source only after we confirm that
|
||||||
|
// legacy Marshal/Unmarshal methods are present, for
|
||||||
|
// consistency.
|
||||||
|
return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
|
||||||
}
|
}
|
||||||
b, err := marshaler.Marshal()
|
b, err := marshaler.Marshal()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return piface.MergeOutput{}
|
return protoiface.MergeOutput{}
|
||||||
}
|
}
|
||||||
err = unmarshaler.Unmarshal(b)
|
err = unmarshaler.Unmarshal(b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return piface.MergeOutput{}
|
return protoiface.MergeOutput{}
|
||||||
}
|
}
|
||||||
return piface.MergeOutput{Flags: piface.MergeComplete}
|
return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
|
||||||
}
|
}
|
||||||
|
|
||||||
// aberrantMessageType implements MessageType for all types other than pointer-to-struct.
|
// aberrantMessageType implements MessageType for all types other than pointer-to-struct.
|
||||||
|
|
@ -456,19 +470,19 @@ type aberrantMessageType struct {
|
||||||
t reflect.Type
|
t reflect.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mt aberrantMessageType) New() pref.Message {
|
func (mt aberrantMessageType) New() protoreflect.Message {
|
||||||
if mt.t.Kind() == reflect.Ptr {
|
if mt.t.Kind() == reflect.Ptr {
|
||||||
return aberrantMessage{reflect.New(mt.t.Elem())}
|
return aberrantMessage{reflect.New(mt.t.Elem())}
|
||||||
}
|
}
|
||||||
return aberrantMessage{reflect.Zero(mt.t)}
|
return aberrantMessage{reflect.Zero(mt.t)}
|
||||||
}
|
}
|
||||||
func (mt aberrantMessageType) Zero() pref.Message {
|
func (mt aberrantMessageType) Zero() protoreflect.Message {
|
||||||
return aberrantMessage{reflect.Zero(mt.t)}
|
return aberrantMessage{reflect.Zero(mt.t)}
|
||||||
}
|
}
|
||||||
func (mt aberrantMessageType) GoType() reflect.Type {
|
func (mt aberrantMessageType) GoType() reflect.Type {
|
||||||
return mt.t
|
return mt.t
|
||||||
}
|
}
|
||||||
func (mt aberrantMessageType) Descriptor() pref.MessageDescriptor {
|
func (mt aberrantMessageType) Descriptor() protoreflect.MessageDescriptor {
|
||||||
return LegacyLoadMessageDesc(mt.t)
|
return LegacyLoadMessageDesc(mt.t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -492,56 +506,56 @@ func (m aberrantMessage) Reset() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m aberrantMessage) ProtoReflect() pref.Message {
|
func (m aberrantMessage) ProtoReflect() protoreflect.Message {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m aberrantMessage) Descriptor() pref.MessageDescriptor {
|
func (m aberrantMessage) Descriptor() protoreflect.MessageDescriptor {
|
||||||
return LegacyLoadMessageDesc(m.v.Type())
|
return LegacyLoadMessageDesc(m.v.Type())
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Type() pref.MessageType {
|
func (m aberrantMessage) Type() protoreflect.MessageType {
|
||||||
return aberrantMessageType{m.v.Type()}
|
return aberrantMessageType{m.v.Type()}
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) New() pref.Message {
|
func (m aberrantMessage) New() protoreflect.Message {
|
||||||
if m.v.Type().Kind() == reflect.Ptr {
|
if m.v.Type().Kind() == reflect.Ptr {
|
||||||
return aberrantMessage{reflect.New(m.v.Type().Elem())}
|
return aberrantMessage{reflect.New(m.v.Type().Elem())}
|
||||||
}
|
}
|
||||||
return aberrantMessage{reflect.Zero(m.v.Type())}
|
return aberrantMessage{reflect.Zero(m.v.Type())}
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Interface() pref.ProtoMessage {
|
func (m aberrantMessage) Interface() protoreflect.ProtoMessage {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
|
func (m aberrantMessage) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Has(pref.FieldDescriptor) bool {
|
func (m aberrantMessage) Has(protoreflect.FieldDescriptor) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Clear(pref.FieldDescriptor) {
|
func (m aberrantMessage) Clear(protoreflect.FieldDescriptor) {
|
||||||
panic("invalid Message.Clear on " + string(m.Descriptor().FullName()))
|
panic("invalid Message.Clear on " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Get(fd pref.FieldDescriptor) pref.Value {
|
func (m aberrantMessage) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
if fd.Default().IsValid() {
|
if fd.Default().IsValid() {
|
||||||
return fd.Default()
|
return fd.Default()
|
||||||
}
|
}
|
||||||
panic("invalid Message.Get on " + string(m.Descriptor().FullName()))
|
panic("invalid Message.Get on " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Set(pref.FieldDescriptor, pref.Value) {
|
func (m aberrantMessage) Set(protoreflect.FieldDescriptor, protoreflect.Value) {
|
||||||
panic("invalid Message.Set on " + string(m.Descriptor().FullName()))
|
panic("invalid Message.Set on " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Mutable(pref.FieldDescriptor) pref.Value {
|
func (m aberrantMessage) Mutable(protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
panic("invalid Message.Mutable on " + string(m.Descriptor().FullName()))
|
panic("invalid Message.Mutable on " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) NewField(pref.FieldDescriptor) pref.Value {
|
func (m aberrantMessage) NewField(protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
panic("invalid Message.NewField on " + string(m.Descriptor().FullName()))
|
panic("invalid Message.NewField on " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) WhichOneof(pref.OneofDescriptor) pref.FieldDescriptor {
|
func (m aberrantMessage) WhichOneof(protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||||
panic("invalid Message.WhichOneof descriptor on " + string(m.Descriptor().FullName()))
|
panic("invalid Message.WhichOneof descriptor on " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) GetUnknown() pref.RawFields {
|
func (m aberrantMessage) GetUnknown() protoreflect.RawFields {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) SetUnknown(pref.RawFields) {
|
func (m aberrantMessage) SetUnknown(protoreflect.RawFields) {
|
||||||
// SetUnknown discards its input on messages which don't support unknown field storage.
|
// SetUnknown discards its input on messages which don't support unknown field storage.
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) IsValid() bool {
|
func (m aberrantMessage) IsValid() bool {
|
||||||
|
|
@ -550,7 +564,7 @@ func (m aberrantMessage) IsValid() bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) ProtoMethods() *piface.Methods {
|
func (m aberrantMessage) ProtoMethods() *protoiface.Methods {
|
||||||
return aberrantProtoMethods
|
return aberrantProtoMethods
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) protoUnwrap() interface{} {
|
func (m aberrantMessage) protoUnwrap() interface{} {
|
||||||
|
|
|
||||||
32
vendor/google.golang.org/protobuf/internal/impl/merge.go
generated
vendored
32
vendor/google.golang.org/protobuf/internal/impl/merge.go
generated
vendored
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mergeOptions struct{}
|
type mergeOptions struct{}
|
||||||
|
|
@ -20,17 +20,17 @@ func (o mergeOptions) Merge(dst, src proto.Message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge is protoreflect.Methods.Merge.
|
// merge is protoreflect.Methods.Merge.
|
||||||
func (mi *MessageInfo) merge(in piface.MergeInput) piface.MergeOutput {
|
func (mi *MessageInfo) merge(in protoiface.MergeInput) protoiface.MergeOutput {
|
||||||
dp, ok := mi.getPointer(in.Destination)
|
dp, ok := mi.getPointer(in.Destination)
|
||||||
if !ok {
|
if !ok {
|
||||||
return piface.MergeOutput{}
|
return protoiface.MergeOutput{}
|
||||||
}
|
}
|
||||||
sp, ok := mi.getPointer(in.Source)
|
sp, ok := mi.getPointer(in.Source)
|
||||||
if !ok {
|
if !ok {
|
||||||
return piface.MergeOutput{}
|
return protoiface.MergeOutput{}
|
||||||
}
|
}
|
||||||
mi.mergePointer(dp, sp, mergeOptions{})
|
mi.mergePointer(dp, sp, mergeOptions{})
|
||||||
return piface.MergeOutput{Flags: piface.MergeComplete}
|
return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {
|
func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {
|
||||||
|
|
@ -64,7 +64,7 @@ func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
dx := (*dext)[num]
|
dx := (*dext)[num]
|
||||||
var dv pref.Value
|
var dv protoreflect.Value
|
||||||
if dx.Type() == sx.Type() {
|
if dx.Type() == sx.Type() {
|
||||||
dv = dx.Value()
|
dv = dx.Value()
|
||||||
}
|
}
|
||||||
|
|
@ -85,15 +85,15 @@ func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeScalarValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
func mergeScalarValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||||
return src
|
return src
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeBytesValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
func mergeBytesValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||||
return pref.ValueOfBytes(append(emptyBuf[:], src.Bytes()...))
|
return protoreflect.ValueOfBytes(append(emptyBuf[:], src.Bytes()...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeListValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
func mergeListValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||||
dstl := dst.List()
|
dstl := dst.List()
|
||||||
srcl := src.List()
|
srcl := src.List()
|
||||||
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
||||||
|
|
@ -102,29 +102,29 @@ func mergeListValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeBytesListValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
func mergeBytesListValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||||
dstl := dst.List()
|
dstl := dst.List()
|
||||||
srcl := src.List()
|
srcl := src.List()
|
||||||
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
||||||
sb := srcl.Get(i).Bytes()
|
sb := srcl.Get(i).Bytes()
|
||||||
db := append(emptyBuf[:], sb...)
|
db := append(emptyBuf[:], sb...)
|
||||||
dstl.Append(pref.ValueOfBytes(db))
|
dstl.Append(protoreflect.ValueOfBytes(db))
|
||||||
}
|
}
|
||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeMessageListValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
func mergeMessageListValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||||
dstl := dst.List()
|
dstl := dst.List()
|
||||||
srcl := src.List()
|
srcl := src.List()
|
||||||
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
||||||
sm := srcl.Get(i).Message()
|
sm := srcl.Get(i).Message()
|
||||||
dm := proto.Clone(sm.Interface()).ProtoReflect()
|
dm := proto.Clone(sm.Interface()).ProtoReflect()
|
||||||
dstl.Append(pref.ValueOfMessage(dm))
|
dstl.Append(protoreflect.ValueOfMessage(dm))
|
||||||
}
|
}
|
||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeMessageValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
func mergeMessageValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||||
opts.Merge(dst.Message().Interface(), src.Message().Interface())
|
opts.Merge(dst.Message().Interface(), src.Message().Interface())
|
||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
|
|
|
||||||
58
vendor/google.golang.org/protobuf/internal/impl/message.go
generated
vendored
58
vendor/google.golang.org/protobuf/internal/impl/message.go
generated
vendored
|
|
@ -14,8 +14,7 @@ import (
|
||||||
|
|
||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MessageInfo provides protobuf related functionality for a given Go type
|
// MessageInfo provides protobuf related functionality for a given Go type
|
||||||
|
|
@ -29,7 +28,7 @@ type MessageInfo struct {
|
||||||
GoReflectType reflect.Type // pointer to struct
|
GoReflectType reflect.Type // pointer to struct
|
||||||
|
|
||||||
// Desc is the underlying message descriptor type and must be populated.
|
// Desc is the underlying message descriptor type and must be populated.
|
||||||
Desc pref.MessageDescriptor
|
Desc protoreflect.MessageDescriptor
|
||||||
|
|
||||||
// Exporter must be provided in a purego environment in order to provide
|
// Exporter must be provided in a purego environment in order to provide
|
||||||
// access to unexported fields.
|
// access to unexported fields.
|
||||||
|
|
@ -54,7 +53,7 @@ type exporter func(v interface{}, i int) interface{}
|
||||||
// is generated by our implementation of protoc-gen-go (for v2 and on).
|
// is generated by our implementation of protoc-gen-go (for v2 and on).
|
||||||
// If it is unable to obtain a MessageInfo, it returns nil.
|
// If it is unable to obtain a MessageInfo, it returns nil.
|
||||||
func getMessageInfo(mt reflect.Type) *MessageInfo {
|
func getMessageInfo(mt reflect.Type) *MessageInfo {
|
||||||
m, ok := reflect.Zero(mt).Interface().(pref.ProtoMessage)
|
m, ok := reflect.Zero(mt).Interface().(protoreflect.ProtoMessage)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -97,7 +96,7 @@ func (mi *MessageInfo) initOnce() {
|
||||||
// getPointer returns the pointer for a message, which should be of
|
// getPointer returns the pointer for a message, which should be of
|
||||||
// the type of the MessageInfo. If the message is of a different type,
|
// the type of the MessageInfo. If the message is of a different type,
|
||||||
// it returns ok==false.
|
// it returns ok==false.
|
||||||
func (mi *MessageInfo) getPointer(m pref.Message) (p pointer, ok bool) {
|
func (mi *MessageInfo) getPointer(m protoreflect.Message) (p pointer, ok bool) {
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *messageState:
|
case *messageState:
|
||||||
return m.pointer(), m.messageInfo() == mi
|
return m.pointer(), m.messageInfo() == mi
|
||||||
|
|
@ -134,10 +133,10 @@ type structInfo struct {
|
||||||
extensionOffset offset
|
extensionOffset offset
|
||||||
extensionType reflect.Type
|
extensionType reflect.Type
|
||||||
|
|
||||||
fieldsByNumber map[pref.FieldNumber]reflect.StructField
|
fieldsByNumber map[protoreflect.FieldNumber]reflect.StructField
|
||||||
oneofsByName map[pref.Name]reflect.StructField
|
oneofsByName map[protoreflect.Name]reflect.StructField
|
||||||
oneofWrappersByType map[reflect.Type]pref.FieldNumber
|
oneofWrappersByType map[reflect.Type]protoreflect.FieldNumber
|
||||||
oneofWrappersByNumber map[pref.FieldNumber]reflect.Type
|
oneofWrappersByNumber map[protoreflect.FieldNumber]reflect.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo {
|
func (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo {
|
||||||
|
|
@ -147,10 +146,10 @@ func (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo {
|
||||||
unknownOffset: invalidOffset,
|
unknownOffset: invalidOffset,
|
||||||
extensionOffset: invalidOffset,
|
extensionOffset: invalidOffset,
|
||||||
|
|
||||||
fieldsByNumber: map[pref.FieldNumber]reflect.StructField{},
|
fieldsByNumber: map[protoreflect.FieldNumber]reflect.StructField{},
|
||||||
oneofsByName: map[pref.Name]reflect.StructField{},
|
oneofsByName: map[protoreflect.Name]reflect.StructField{},
|
||||||
oneofWrappersByType: map[reflect.Type]pref.FieldNumber{},
|
oneofWrappersByType: map[reflect.Type]protoreflect.FieldNumber{},
|
||||||
oneofWrappersByNumber: map[pref.FieldNumber]reflect.Type{},
|
oneofWrappersByNumber: map[protoreflect.FieldNumber]reflect.Type{},
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldLoop:
|
fieldLoop:
|
||||||
|
|
@ -180,12 +179,12 @@ fieldLoop:
|
||||||
for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
|
for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
|
||||||
if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
|
if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
|
||||||
n, _ := strconv.ParseUint(s, 10, 64)
|
n, _ := strconv.ParseUint(s, 10, 64)
|
||||||
si.fieldsByNumber[pref.FieldNumber(n)] = f
|
si.fieldsByNumber[protoreflect.FieldNumber(n)] = f
|
||||||
continue fieldLoop
|
continue fieldLoop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if s := f.Tag.Get("protobuf_oneof"); len(s) > 0 {
|
if s := f.Tag.Get("protobuf_oneof"); len(s) > 0 {
|
||||||
si.oneofsByName[pref.Name(s)] = f
|
si.oneofsByName[protoreflect.Name(s)] = f
|
||||||
continue fieldLoop
|
continue fieldLoop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -193,12 +192,17 @@ fieldLoop:
|
||||||
|
|
||||||
// Derive a mapping of oneof wrappers to fields.
|
// Derive a mapping of oneof wrappers to fields.
|
||||||
oneofWrappers := mi.OneofWrappers
|
oneofWrappers := mi.OneofWrappers
|
||||||
for _, method := range []string{"XXX_OneofFuncs", "XXX_OneofWrappers"} {
|
methods := make([]reflect.Method, 0, 2)
|
||||||
if fn, ok := reflect.PtrTo(t).MethodByName(method); ok {
|
if m, ok := reflect.PtrTo(t).MethodByName("XXX_OneofFuncs"); ok {
|
||||||
for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {
|
methods = append(methods, m)
|
||||||
if vs, ok := v.Interface().([]interface{}); ok {
|
}
|
||||||
oneofWrappers = vs
|
if m, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok {
|
||||||
}
|
methods = append(methods, m)
|
||||||
|
}
|
||||||
|
for _, fn := range methods {
|
||||||
|
for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {
|
||||||
|
if vs, ok := v.Interface().([]interface{}); ok {
|
||||||
|
oneofWrappers = vs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -208,8 +212,8 @@ fieldLoop:
|
||||||
for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
|
for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
|
||||||
if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
|
if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
|
||||||
n, _ := strconv.ParseUint(s, 10, 64)
|
n, _ := strconv.ParseUint(s, 10, 64)
|
||||||
si.oneofWrappersByType[tf] = pref.FieldNumber(n)
|
si.oneofWrappersByType[tf] = protoreflect.FieldNumber(n)
|
||||||
si.oneofWrappersByNumber[pref.FieldNumber(n)] = tf
|
si.oneofWrappersByNumber[protoreflect.FieldNumber(n)] = tf
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -219,7 +223,11 @@ fieldLoop:
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mi *MessageInfo) New() protoreflect.Message {
|
func (mi *MessageInfo) New() protoreflect.Message {
|
||||||
return mi.MessageOf(reflect.New(mi.GoReflectType.Elem()).Interface())
|
m := reflect.New(mi.GoReflectType.Elem()).Interface()
|
||||||
|
if r, ok := m.(protoreflect.ProtoMessage); ok {
|
||||||
|
return r.ProtoReflect()
|
||||||
|
}
|
||||||
|
return mi.MessageOf(m)
|
||||||
}
|
}
|
||||||
func (mi *MessageInfo) Zero() protoreflect.Message {
|
func (mi *MessageInfo) Zero() protoreflect.Message {
|
||||||
return mi.MessageOf(reflect.Zero(mi.GoReflectType).Interface())
|
return mi.MessageOf(reflect.Zero(mi.GoReflectType).Interface())
|
||||||
|
|
@ -237,7 +245,7 @@ func (mi *MessageInfo) Message(i int) protoreflect.MessageType {
|
||||||
fd := mi.Desc.Fields().Get(i)
|
fd := mi.Desc.Fields().Get(i)
|
||||||
switch {
|
switch {
|
||||||
case fd.IsWeak():
|
case fd.IsWeak():
|
||||||
mt, _ := preg.GlobalTypes.FindMessageByName(fd.Message().FullName())
|
mt, _ := protoregistry.GlobalTypes.FindMessageByName(fd.Message().FullName())
|
||||||
return mt
|
return mt
|
||||||
case fd.IsMap():
|
case fd.IsMap():
|
||||||
return mapEntryType{fd.Message(), mi.fieldTypes[fd.Number()]}
|
return mapEntryType{fd.Message(), mi.fieldTypes[fd.Number()]}
|
||||||
|
|
|
||||||
93
vendor/google.golang.org/protobuf/internal/impl/message_reflect.go
generated
vendored
93
vendor/google.golang.org/protobuf/internal/impl/message_reflect.go
generated
vendored
|
|
@ -10,17 +10,17 @@ import (
|
||||||
|
|
||||||
"google.golang.org/protobuf/internal/detrand"
|
"google.golang.org/protobuf/internal/detrand"
|
||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type reflectMessageInfo struct {
|
type reflectMessageInfo struct {
|
||||||
fields map[pref.FieldNumber]*fieldInfo
|
fields map[protoreflect.FieldNumber]*fieldInfo
|
||||||
oneofs map[pref.Name]*oneofInfo
|
oneofs map[protoreflect.Name]*oneofInfo
|
||||||
|
|
||||||
// fieldTypes contains the zero value of an enum or message field.
|
// fieldTypes contains the zero value of an enum or message field.
|
||||||
// For lists, it contains the element type.
|
// For lists, it contains the element type.
|
||||||
// For maps, it contains the entry value type.
|
// For maps, it contains the entry value type.
|
||||||
fieldTypes map[pref.FieldNumber]interface{}
|
fieldTypes map[protoreflect.FieldNumber]interface{}
|
||||||
|
|
||||||
// denseFields is a subset of fields where:
|
// denseFields is a subset of fields where:
|
||||||
// 0 < fieldDesc.Number() < len(denseFields)
|
// 0 < fieldDesc.Number() < len(denseFields)
|
||||||
|
|
@ -30,8 +30,8 @@ type reflectMessageInfo struct {
|
||||||
// rangeInfos is a list of all fields (not belonging to a oneof) and oneofs.
|
// rangeInfos is a list of all fields (not belonging to a oneof) and oneofs.
|
||||||
rangeInfos []interface{} // either *fieldInfo or *oneofInfo
|
rangeInfos []interface{} // either *fieldInfo or *oneofInfo
|
||||||
|
|
||||||
getUnknown func(pointer) pref.RawFields
|
getUnknown func(pointer) protoreflect.RawFields
|
||||||
setUnknown func(pointer, pref.RawFields)
|
setUnknown func(pointer, protoreflect.RawFields)
|
||||||
extensionMap func(pointer) *extensionMap
|
extensionMap func(pointer) *extensionMap
|
||||||
|
|
||||||
nilMessage atomicNilMessage
|
nilMessage atomicNilMessage
|
||||||
|
|
@ -52,7 +52,7 @@ func (mi *MessageInfo) makeReflectFuncs(t reflect.Type, si structInfo) {
|
||||||
// This code assumes that the struct is well-formed and panics if there are
|
// This code assumes that the struct is well-formed and panics if there are
|
||||||
// any discrepancies.
|
// any discrepancies.
|
||||||
func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) {
|
func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) {
|
||||||
mi.fields = map[pref.FieldNumber]*fieldInfo{}
|
mi.fields = map[protoreflect.FieldNumber]*fieldInfo{}
|
||||||
md := mi.Desc
|
md := mi.Desc
|
||||||
fds := md.Fields()
|
fds := md.Fields()
|
||||||
for i := 0; i < fds.Len(); i++ {
|
for i := 0; i < fds.Len(); i++ {
|
||||||
|
|
@ -82,7 +82,7 @@ func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) {
|
||||||
mi.fields[fd.Number()] = &fi
|
mi.fields[fd.Number()] = &fi
|
||||||
}
|
}
|
||||||
|
|
||||||
mi.oneofs = map[pref.Name]*oneofInfo{}
|
mi.oneofs = map[protoreflect.Name]*oneofInfo{}
|
||||||
for i := 0; i < md.Oneofs().Len(); i++ {
|
for i := 0; i < md.Oneofs().Len(); i++ {
|
||||||
od := md.Oneofs().Get(i)
|
od := md.Oneofs().Get(i)
|
||||||
mi.oneofs[od.Name()] = makeOneofInfo(od, si, mi.Exporter)
|
mi.oneofs[od.Name()] = makeOneofInfo(od, si, mi.Exporter)
|
||||||
|
|
@ -117,13 +117,13 @@ func (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) {
|
||||||
switch {
|
switch {
|
||||||
case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsAType:
|
case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsAType:
|
||||||
// Handle as []byte.
|
// Handle as []byte.
|
||||||
mi.getUnknown = func(p pointer) pref.RawFields {
|
mi.getUnknown = func(p pointer) protoreflect.RawFields {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return *p.Apply(mi.unknownOffset).Bytes()
|
return *p.Apply(mi.unknownOffset).Bytes()
|
||||||
}
|
}
|
||||||
mi.setUnknown = func(p pointer, b pref.RawFields) {
|
mi.setUnknown = func(p pointer, b protoreflect.RawFields) {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
panic("invalid SetUnknown on nil Message")
|
panic("invalid SetUnknown on nil Message")
|
||||||
}
|
}
|
||||||
|
|
@ -131,7 +131,7 @@ func (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) {
|
||||||
}
|
}
|
||||||
case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsBType:
|
case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsBType:
|
||||||
// Handle as *[]byte.
|
// Handle as *[]byte.
|
||||||
mi.getUnknown = func(p pointer) pref.RawFields {
|
mi.getUnknown = func(p pointer) protoreflect.RawFields {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -141,7 +141,7 @@ func (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) {
|
||||||
}
|
}
|
||||||
return **bp
|
return **bp
|
||||||
}
|
}
|
||||||
mi.setUnknown = func(p pointer, b pref.RawFields) {
|
mi.setUnknown = func(p pointer, b protoreflect.RawFields) {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
panic("invalid SetUnknown on nil Message")
|
panic("invalid SetUnknown on nil Message")
|
||||||
}
|
}
|
||||||
|
|
@ -152,10 +152,10 @@ func (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) {
|
||||||
**bp = b
|
**bp = b
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
mi.getUnknown = func(pointer) pref.RawFields {
|
mi.getUnknown = func(pointer) protoreflect.RawFields {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
mi.setUnknown = func(p pointer, _ pref.RawFields) {
|
mi.setUnknown = func(p pointer, _ protoreflect.RawFields) {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
panic("invalid SetUnknown on nil Message")
|
panic("invalid SetUnknown on nil Message")
|
||||||
}
|
}
|
||||||
|
|
@ -224,7 +224,7 @@ func (mi *MessageInfo) makeFieldTypes(si structInfo) {
|
||||||
}
|
}
|
||||||
if ft != nil {
|
if ft != nil {
|
||||||
if mi.fieldTypes == nil {
|
if mi.fieldTypes == nil {
|
||||||
mi.fieldTypes = make(map[pref.FieldNumber]interface{})
|
mi.fieldTypes = make(map[protoreflect.FieldNumber]interface{})
|
||||||
}
|
}
|
||||||
mi.fieldTypes[fd.Number()] = reflect.Zero(ft).Interface()
|
mi.fieldTypes[fd.Number()] = reflect.Zero(ft).Interface()
|
||||||
}
|
}
|
||||||
|
|
@ -233,7 +233,7 @@ func (mi *MessageInfo) makeFieldTypes(si structInfo) {
|
||||||
|
|
||||||
type extensionMap map[int32]ExtensionField
|
type extensionMap map[int32]ExtensionField
|
||||||
|
|
||||||
func (m *extensionMap) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
|
func (m *extensionMap) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
for _, x := range *m {
|
for _, x := range *m {
|
||||||
xd := x.Type().TypeDescriptor()
|
xd := x.Type().TypeDescriptor()
|
||||||
|
|
@ -247,11 +247,10 @@ func (m *extensionMap) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *extensionMap) Has(xt pref.ExtensionType) (ok bool) {
|
func (m *extensionMap) Has(xd protoreflect.ExtensionTypeDescriptor) (ok bool) {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
xd := xt.TypeDescriptor()
|
|
||||||
x, ok := (*m)[int32(xd.Number())]
|
x, ok := (*m)[int32(xd.Number())]
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
|
|
@ -261,25 +260,22 @@ func (m *extensionMap) Has(xt pref.ExtensionType) (ok bool) {
|
||||||
return x.Value().List().Len() > 0
|
return x.Value().List().Len() > 0
|
||||||
case xd.IsMap():
|
case xd.IsMap():
|
||||||
return x.Value().Map().Len() > 0
|
return x.Value().Map().Len() > 0
|
||||||
case xd.Message() != nil:
|
|
||||||
return x.Value().Message().IsValid()
|
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
func (m *extensionMap) Clear(xt pref.ExtensionType) {
|
func (m *extensionMap) Clear(xd protoreflect.ExtensionTypeDescriptor) {
|
||||||
delete(*m, int32(xt.TypeDescriptor().Number()))
|
delete(*m, int32(xd.Number()))
|
||||||
}
|
}
|
||||||
func (m *extensionMap) Get(xt pref.ExtensionType) pref.Value {
|
func (m *extensionMap) Get(xd protoreflect.ExtensionTypeDescriptor) protoreflect.Value {
|
||||||
xd := xt.TypeDescriptor()
|
|
||||||
if m != nil {
|
if m != nil {
|
||||||
if x, ok := (*m)[int32(xd.Number())]; ok {
|
if x, ok := (*m)[int32(xd.Number())]; ok {
|
||||||
return x.Value()
|
return x.Value()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return xt.Zero()
|
return xd.Type().Zero()
|
||||||
}
|
}
|
||||||
func (m *extensionMap) Set(xt pref.ExtensionType, v pref.Value) {
|
func (m *extensionMap) Set(xd protoreflect.ExtensionTypeDescriptor, v protoreflect.Value) {
|
||||||
xd := xt.TypeDescriptor()
|
xt := xd.Type()
|
||||||
isValid := true
|
isValid := true
|
||||||
switch {
|
switch {
|
||||||
case !xt.IsValidValue(v):
|
case !xt.IsValidValue(v):
|
||||||
|
|
@ -292,7 +288,7 @@ func (m *extensionMap) Set(xt pref.ExtensionType, v pref.Value) {
|
||||||
isValid = v.Message().IsValid()
|
isValid = v.Message().IsValid()
|
||||||
}
|
}
|
||||||
if !isValid {
|
if !isValid {
|
||||||
panic(fmt.Sprintf("%v: assigning invalid value", xt.TypeDescriptor().FullName()))
|
panic(fmt.Sprintf("%v: assigning invalid value", xd.FullName()))
|
||||||
}
|
}
|
||||||
|
|
||||||
if *m == nil {
|
if *m == nil {
|
||||||
|
|
@ -302,16 +298,15 @@ func (m *extensionMap) Set(xt pref.ExtensionType, v pref.Value) {
|
||||||
x.Set(xt, v)
|
x.Set(xt, v)
|
||||||
(*m)[int32(xd.Number())] = x
|
(*m)[int32(xd.Number())] = x
|
||||||
}
|
}
|
||||||
func (m *extensionMap) Mutable(xt pref.ExtensionType) pref.Value {
|
func (m *extensionMap) Mutable(xd protoreflect.ExtensionTypeDescriptor) protoreflect.Value {
|
||||||
xd := xt.TypeDescriptor()
|
if xd.Kind() != protoreflect.MessageKind && xd.Kind() != protoreflect.GroupKind && !xd.IsList() && !xd.IsMap() {
|
||||||
if xd.Kind() != pref.MessageKind && xd.Kind() != pref.GroupKind && !xd.IsList() && !xd.IsMap() {
|
|
||||||
panic("invalid Mutable on field with non-composite type")
|
panic("invalid Mutable on field with non-composite type")
|
||||||
}
|
}
|
||||||
if x, ok := (*m)[int32(xd.Number())]; ok {
|
if x, ok := (*m)[int32(xd.Number())]; ok {
|
||||||
return x.Value()
|
return x.Value()
|
||||||
}
|
}
|
||||||
v := xt.New()
|
v := xd.Type().New()
|
||||||
m.Set(xt, v)
|
m.Set(xd, v)
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -320,7 +315,6 @@ func (m *extensionMap) Mutable(xt pref.ExtensionType) pref.Value {
|
||||||
// in an allocation-free way without needing to have a shadow Go type generated
|
// in an allocation-free way without needing to have a shadow Go type generated
|
||||||
// for every message type. This technique only works using unsafe.
|
// for every message type. This technique only works using unsafe.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// Example generated code:
|
// Example generated code:
|
||||||
//
|
//
|
||||||
// type M struct {
|
// type M struct {
|
||||||
|
|
@ -351,12 +345,11 @@ func (m *extensionMap) Mutable(xt pref.ExtensionType) pref.Value {
|
||||||
// It has access to the message info as its first field, and a pointer to the
|
// It has access to the message info as its first field, and a pointer to the
|
||||||
// MessageState is identical to a pointer to the concrete message value.
|
// MessageState is identical to a pointer to the concrete message value.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// Requirements:
|
// Requirements:
|
||||||
// • The type M must implement protoreflect.ProtoMessage.
|
// - The type M must implement protoreflect.ProtoMessage.
|
||||||
// • The address of m must not be nil.
|
// - The address of m must not be nil.
|
||||||
// • The address of m and the address of m.state must be equal,
|
// - The address of m and the address of m.state must be equal,
|
||||||
// even though they are different Go types.
|
// even though they are different Go types.
|
||||||
type MessageState struct {
|
type MessageState struct {
|
||||||
pragma.NoUnkeyedLiterals
|
pragma.NoUnkeyedLiterals
|
||||||
pragma.DoNotCompare
|
pragma.DoNotCompare
|
||||||
|
|
@ -368,8 +361,8 @@ type MessageState struct {
|
||||||
type messageState MessageState
|
type messageState MessageState
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ pref.Message = (*messageState)(nil)
|
_ protoreflect.Message = (*messageState)(nil)
|
||||||
_ unwrapper = (*messageState)(nil)
|
_ unwrapper = (*messageState)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
// messageDataType is a tuple of a pointer to the message data and
|
// messageDataType is a tuple of a pointer to the message data and
|
||||||
|
|
@ -387,16 +380,16 @@ type (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ pref.Message = (*messageReflectWrapper)(nil)
|
_ protoreflect.Message = (*messageReflectWrapper)(nil)
|
||||||
_ unwrapper = (*messageReflectWrapper)(nil)
|
_ unwrapper = (*messageReflectWrapper)(nil)
|
||||||
_ pref.ProtoMessage = (*messageIfaceWrapper)(nil)
|
_ protoreflect.ProtoMessage = (*messageIfaceWrapper)(nil)
|
||||||
_ unwrapper = (*messageIfaceWrapper)(nil)
|
_ unwrapper = (*messageIfaceWrapper)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
// MessageOf returns a reflective view over a message. The input must be a
|
// MessageOf returns a reflective view over a message. The input must be a
|
||||||
// pointer to a named Go struct. If the provided type has a ProtoReflect method,
|
// pointer to a named Go struct. If the provided type has a ProtoReflect method,
|
||||||
// it must be implemented by calling this method.
|
// it must be implemented by calling this method.
|
||||||
func (mi *MessageInfo) MessageOf(m interface{}) pref.Message {
|
func (mi *MessageInfo) MessageOf(m interface{}) protoreflect.Message {
|
||||||
if reflect.TypeOf(m) != mi.GoReflectType {
|
if reflect.TypeOf(m) != mi.GoReflectType {
|
||||||
panic(fmt.Sprintf("type mismatch: got %T, want %v", m, mi.GoReflectType))
|
panic(fmt.Sprintf("type mismatch: got %T, want %v", m, mi.GoReflectType))
|
||||||
}
|
}
|
||||||
|
|
@ -421,7 +414,7 @@ func (m *messageIfaceWrapper) Reset() {
|
||||||
rv.Elem().Set(reflect.Zero(rv.Type().Elem()))
|
rv.Elem().Set(reflect.Zero(rv.Type().Elem()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageIfaceWrapper) ProtoReflect() pref.Message {
|
func (m *messageIfaceWrapper) ProtoReflect() protoreflect.Message {
|
||||||
return (*messageReflectWrapper)(m)
|
return (*messageReflectWrapper)(m)
|
||||||
}
|
}
|
||||||
func (m *messageIfaceWrapper) protoUnwrap() interface{} {
|
func (m *messageIfaceWrapper) protoUnwrap() interface{} {
|
||||||
|
|
@ -430,7 +423,7 @@ func (m *messageIfaceWrapper) protoUnwrap() interface{} {
|
||||||
|
|
||||||
// checkField verifies that the provided field descriptor is valid.
|
// checkField verifies that the provided field descriptor is valid.
|
||||||
// Exactly one of the returned values is populated.
|
// Exactly one of the returned values is populated.
|
||||||
func (mi *MessageInfo) checkField(fd pref.FieldDescriptor) (*fieldInfo, pref.ExtensionType) {
|
func (mi *MessageInfo) checkField(fd protoreflect.FieldDescriptor) (*fieldInfo, protoreflect.ExtensionTypeDescriptor) {
|
||||||
var fi *fieldInfo
|
var fi *fieldInfo
|
||||||
if n := fd.Number(); 0 < n && int(n) < len(mi.denseFields) {
|
if n := fd.Number(); 0 < n && int(n) < len(mi.denseFields) {
|
||||||
fi = mi.denseFields[n]
|
fi = mi.denseFields[n]
|
||||||
|
|
@ -455,11 +448,11 @@ func (mi *MessageInfo) checkField(fd pref.FieldDescriptor) (*fieldInfo, pref.Ext
|
||||||
if !mi.Desc.ExtensionRanges().Has(fd.Number()) {
|
if !mi.Desc.ExtensionRanges().Has(fd.Number()) {
|
||||||
panic(fmt.Sprintf("extension %v extends %v outside the extension range", fd.FullName(), mi.Desc.FullName()))
|
panic(fmt.Sprintf("extension %v extends %v outside the extension range", fd.FullName(), mi.Desc.FullName()))
|
||||||
}
|
}
|
||||||
xtd, ok := fd.(pref.ExtensionTypeDescriptor)
|
xtd, ok := fd.(protoreflect.ExtensionTypeDescriptor)
|
||||||
if !ok {
|
if !ok {
|
||||||
panic(fmt.Sprintf("extension %v does not implement protoreflect.ExtensionTypeDescriptor", fd.FullName()))
|
panic(fmt.Sprintf("extension %v does not implement protoreflect.ExtensionTypeDescriptor", fd.FullName()))
|
||||||
}
|
}
|
||||||
return nil, xtd.Type()
|
return nil, xtd
|
||||||
}
|
}
|
||||||
panic(fmt.Sprintf("field %v is invalid", fd.FullName()))
|
panic(fmt.Sprintf("field %v is invalid", fd.FullName()))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
120
vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go
generated
vendored
120
vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go
generated
vendored
|
|
@ -11,24 +11,24 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"google.golang.org/protobuf/internal/flags"
|
"google.golang.org/protobuf/internal/flags"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
type fieldInfo struct {
|
type fieldInfo struct {
|
||||||
fieldDesc pref.FieldDescriptor
|
fieldDesc protoreflect.FieldDescriptor
|
||||||
|
|
||||||
// These fields are used for protobuf reflection support.
|
// These fields are used for protobuf reflection support.
|
||||||
has func(pointer) bool
|
has func(pointer) bool
|
||||||
clear func(pointer)
|
clear func(pointer)
|
||||||
get func(pointer) pref.Value
|
get func(pointer) protoreflect.Value
|
||||||
set func(pointer, pref.Value)
|
set func(pointer, protoreflect.Value)
|
||||||
mutable func(pointer) pref.Value
|
mutable func(pointer) protoreflect.Value
|
||||||
newMessage func() pref.Message
|
newMessage func() protoreflect.Message
|
||||||
newField func() pref.Value
|
newField func() protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldInfoForMissing(fd pref.FieldDescriptor) fieldInfo {
|
func fieldInfoForMissing(fd protoreflect.FieldDescriptor) fieldInfo {
|
||||||
// This never occurs for generated message types.
|
// This never occurs for generated message types.
|
||||||
// It implies that a hand-crafted type has missing Go fields
|
// It implies that a hand-crafted type has missing Go fields
|
||||||
// for specific protobuf message fields.
|
// for specific protobuf message fields.
|
||||||
|
|
@ -40,19 +40,19 @@ func fieldInfoForMissing(fd pref.FieldDescriptor) fieldInfo {
|
||||||
clear: func(p pointer) {
|
clear: func(p pointer) {
|
||||||
panic("missing Go struct field for " + string(fd.FullName()))
|
panic("missing Go struct field for " + string(fd.FullName()))
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
return fd.Default()
|
return fd.Default()
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
panic("missing Go struct field for " + string(fd.FullName()))
|
panic("missing Go struct field for " + string(fd.FullName()))
|
||||||
},
|
},
|
||||||
mutable: func(p pointer) pref.Value {
|
mutable: func(p pointer) protoreflect.Value {
|
||||||
panic("missing Go struct field for " + string(fd.FullName()))
|
panic("missing Go struct field for " + string(fd.FullName()))
|
||||||
},
|
},
|
||||||
newMessage: func() pref.Message {
|
newMessage: func() protoreflect.Message {
|
||||||
panic("missing Go struct field for " + string(fd.FullName()))
|
panic("missing Go struct field for " + string(fd.FullName()))
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
if v := fd.Default(); v.IsValid() {
|
if v := fd.Default(); v.IsValid() {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +61,7 @@ func fieldInfoForMissing(fd pref.FieldDescriptor) fieldInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x exporter, ot reflect.Type) fieldInfo {
|
func fieldInfoForOneof(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter, ot reflect.Type) fieldInfo {
|
||||||
ft := fs.Type
|
ft := fs.Type
|
||||||
if ft.Kind() != reflect.Interface {
|
if ft.Kind() != reflect.Interface {
|
||||||
panic(fmt.Sprintf("field %v has invalid type: got %v, want interface kind", fd.FullName(), ft))
|
panic(fmt.Sprintf("field %v has invalid type: got %v, want interface kind", fd.FullName(), ft))
|
||||||
|
|
@ -102,7 +102,7 @@ func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x export
|
||||||
}
|
}
|
||||||
rv.Set(reflect.Zero(rv.Type()))
|
rv.Set(reflect.Zero(rv.Type()))
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return conv.Zero()
|
return conv.Zero()
|
||||||
}
|
}
|
||||||
|
|
@ -113,7 +113,7 @@ func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x export
|
||||||
rv = rv.Elem().Elem().Field(0)
|
rv = rv.Elem().Elem().Field(0)
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
if rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {
|
if rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {
|
||||||
rv.Set(reflect.New(ot))
|
rv.Set(reflect.New(ot))
|
||||||
|
|
@ -121,7 +121,7 @@ func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x export
|
||||||
rv = rv.Elem().Elem().Field(0)
|
rv = rv.Elem().Elem().Field(0)
|
||||||
rv.Set(conv.GoValueOf(v))
|
rv.Set(conv.GoValueOf(v))
|
||||||
},
|
},
|
||||||
mutable: func(p pointer) pref.Value {
|
mutable: func(p pointer) protoreflect.Value {
|
||||||
if !isMessage {
|
if !isMessage {
|
||||||
panic(fmt.Sprintf("field %v with invalid Mutable call on field with non-composite type", fd.FullName()))
|
panic(fmt.Sprintf("field %v with invalid Mutable call on field with non-composite type", fd.FullName()))
|
||||||
}
|
}
|
||||||
|
|
@ -131,20 +131,20 @@ func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x export
|
||||||
}
|
}
|
||||||
rv = rv.Elem().Elem().Field(0)
|
rv = rv.Elem().Elem().Field(0)
|
||||||
if rv.Kind() == reflect.Ptr && rv.IsNil() {
|
if rv.Kind() == reflect.Ptr && rv.IsNil() {
|
||||||
rv.Set(conv.GoValueOf(pref.ValueOfMessage(conv.New().Message())))
|
rv.Set(conv.GoValueOf(protoreflect.ValueOfMessage(conv.New().Message())))
|
||||||
}
|
}
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
newMessage: func() pref.Message {
|
newMessage: func() protoreflect.Message {
|
||||||
return conv.New().Message()
|
return conv.New().Message()
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
return conv.New()
|
return conv.New()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
func fieldInfoForMap(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||||
ft := fs.Type
|
ft := fs.Type
|
||||||
if ft.Kind() != reflect.Map {
|
if ft.Kind() != reflect.Map {
|
||||||
panic(fmt.Sprintf("field %v has invalid type: got %v, want map kind", fd.FullName(), ft))
|
panic(fmt.Sprintf("field %v has invalid type: got %v, want map kind", fd.FullName(), ft))
|
||||||
|
|
@ -166,7 +166,7 @@ func fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
rv.Set(reflect.Zero(rv.Type()))
|
rv.Set(reflect.Zero(rv.Type()))
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return conv.Zero()
|
return conv.Zero()
|
||||||
}
|
}
|
||||||
|
|
@ -176,7 +176,7 @@ func fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter
|
||||||
}
|
}
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
pv := conv.GoValueOf(v)
|
pv := conv.GoValueOf(v)
|
||||||
if pv.IsNil() {
|
if pv.IsNil() {
|
||||||
|
|
@ -184,20 +184,20 @@ func fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter
|
||||||
}
|
}
|
||||||
rv.Set(pv)
|
rv.Set(pv)
|
||||||
},
|
},
|
||||||
mutable: func(p pointer) pref.Value {
|
mutable: func(p pointer) protoreflect.Value {
|
||||||
v := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
v := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
if v.IsNil() {
|
if v.IsNil() {
|
||||||
v.Set(reflect.MakeMap(fs.Type))
|
v.Set(reflect.MakeMap(fs.Type))
|
||||||
}
|
}
|
||||||
return conv.PBValueOf(v)
|
return conv.PBValueOf(v)
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
return conv.New()
|
return conv.New()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
func fieldInfoForList(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||||
ft := fs.Type
|
ft := fs.Type
|
||||||
if ft.Kind() != reflect.Slice {
|
if ft.Kind() != reflect.Slice {
|
||||||
panic(fmt.Sprintf("field %v has invalid type: got %v, want slice kind", fd.FullName(), ft))
|
panic(fmt.Sprintf("field %v has invalid type: got %v, want slice kind", fd.FullName(), ft))
|
||||||
|
|
@ -219,7 +219,7 @@ func fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporte
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
rv.Set(reflect.Zero(rv.Type()))
|
rv.Set(reflect.Zero(rv.Type()))
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return conv.Zero()
|
return conv.Zero()
|
||||||
}
|
}
|
||||||
|
|
@ -229,7 +229,7 @@ func fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporte
|
||||||
}
|
}
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
pv := conv.GoValueOf(v)
|
pv := conv.GoValueOf(v)
|
||||||
if pv.IsNil() {
|
if pv.IsNil() {
|
||||||
|
|
@ -237,11 +237,11 @@ func fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporte
|
||||||
}
|
}
|
||||||
rv.Set(pv.Elem())
|
rv.Set(pv.Elem())
|
||||||
},
|
},
|
||||||
mutable: func(p pointer) pref.Value {
|
mutable: func(p pointer) protoreflect.Value {
|
||||||
v := p.Apply(fieldOffset).AsValueOf(fs.Type)
|
v := p.Apply(fieldOffset).AsValueOf(fs.Type)
|
||||||
return conv.PBValueOf(v)
|
return conv.PBValueOf(v)
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
return conv.New()
|
return conv.New()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -252,7 +252,7 @@ var (
|
||||||
emptyBytes = reflect.ValueOf([]byte{})
|
emptyBytes = reflect.ValueOf([]byte{})
|
||||||
)
|
)
|
||||||
|
|
||||||
func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
func fieldInfoForScalar(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||||
ft := fs.Type
|
ft := fs.Type
|
||||||
nullable := fd.HasPresence()
|
nullable := fd.HasPresence()
|
||||||
isBytes := ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8
|
isBytes := ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8
|
||||||
|
|
@ -300,7 +300,7 @@ func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x expor
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
rv.Set(reflect.Zero(rv.Type()))
|
rv.Set(reflect.Zero(rv.Type()))
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return conv.Zero()
|
return conv.Zero()
|
||||||
}
|
}
|
||||||
|
|
@ -315,7 +315,7 @@ func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x expor
|
||||||
}
|
}
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
if nullable && rv.Kind() == reflect.Ptr {
|
if nullable && rv.Kind() == reflect.Ptr {
|
||||||
if rv.IsNil() {
|
if rv.IsNil() {
|
||||||
|
|
@ -332,23 +332,23 @@ func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x expor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
return conv.New()
|
return conv.New()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldInfo {
|
func fieldInfoForWeakMessage(fd protoreflect.FieldDescriptor, weakOffset offset) fieldInfo {
|
||||||
if !flags.ProtoLegacy {
|
if !flags.ProtoLegacy {
|
||||||
panic("no support for proto1 weak fields")
|
panic("no support for proto1 weak fields")
|
||||||
}
|
}
|
||||||
|
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
var messageType pref.MessageType
|
var messageType protoreflect.MessageType
|
||||||
lazyInit := func() {
|
lazyInit := func() {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
messageName := fd.Message().FullName()
|
messageName := fd.Message().FullName()
|
||||||
messageType, _ = preg.GlobalTypes.FindMessageByName(messageName)
|
messageType, _ = protoregistry.GlobalTypes.FindMessageByName(messageName)
|
||||||
if messageType == nil {
|
if messageType == nil {
|
||||||
panic(fmt.Sprintf("weak message %v for field %v is not linked in", messageName, fd.FullName()))
|
panic(fmt.Sprintf("weak message %v for field %v is not linked in", messageName, fd.FullName()))
|
||||||
}
|
}
|
||||||
|
|
@ -368,18 +368,18 @@ func fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldIn
|
||||||
clear: func(p pointer) {
|
clear: func(p pointer) {
|
||||||
p.Apply(weakOffset).WeakFields().clear(num)
|
p.Apply(weakOffset).WeakFields().clear(num)
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
lazyInit()
|
lazyInit()
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return pref.ValueOfMessage(messageType.Zero())
|
return protoreflect.ValueOfMessage(messageType.Zero())
|
||||||
}
|
}
|
||||||
m, ok := p.Apply(weakOffset).WeakFields().get(num)
|
m, ok := p.Apply(weakOffset).WeakFields().get(num)
|
||||||
if !ok {
|
if !ok {
|
||||||
return pref.ValueOfMessage(messageType.Zero())
|
return protoreflect.ValueOfMessage(messageType.Zero())
|
||||||
}
|
}
|
||||||
return pref.ValueOfMessage(m.ProtoReflect())
|
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
lazyInit()
|
lazyInit()
|
||||||
m := v.Message()
|
m := v.Message()
|
||||||
if m.Descriptor() != messageType.Descriptor() {
|
if m.Descriptor() != messageType.Descriptor() {
|
||||||
|
|
@ -390,7 +390,7 @@ func fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldIn
|
||||||
}
|
}
|
||||||
p.Apply(weakOffset).WeakFields().set(num, m.Interface())
|
p.Apply(weakOffset).WeakFields().set(num, m.Interface())
|
||||||
},
|
},
|
||||||
mutable: func(p pointer) pref.Value {
|
mutable: func(p pointer) protoreflect.Value {
|
||||||
lazyInit()
|
lazyInit()
|
||||||
fs := p.Apply(weakOffset).WeakFields()
|
fs := p.Apply(weakOffset).WeakFields()
|
||||||
m, ok := fs.get(num)
|
m, ok := fs.get(num)
|
||||||
|
|
@ -398,20 +398,20 @@ func fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldIn
|
||||||
m = messageType.New().Interface()
|
m = messageType.New().Interface()
|
||||||
fs.set(num, m)
|
fs.set(num, m)
|
||||||
}
|
}
|
||||||
return pref.ValueOfMessage(m.ProtoReflect())
|
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||||
},
|
},
|
||||||
newMessage: func() pref.Message {
|
newMessage: func() protoreflect.Message {
|
||||||
lazyInit()
|
lazyInit()
|
||||||
return messageType.New()
|
return messageType.New()
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
lazyInit()
|
lazyInit()
|
||||||
return pref.ValueOfMessage(messageType.New())
|
return protoreflect.ValueOfMessage(messageType.New())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldInfoForMessage(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
func fieldInfoForMessage(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||||
ft := fs.Type
|
ft := fs.Type
|
||||||
conv := NewConverter(ft, fd)
|
conv := NewConverter(ft, fd)
|
||||||
|
|
||||||
|
|
@ -433,47 +433,47 @@ func fieldInfoForMessage(fd pref.FieldDescriptor, fs reflect.StructField, x expo
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
rv.Set(reflect.Zero(rv.Type()))
|
rv.Set(reflect.Zero(rv.Type()))
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return conv.Zero()
|
return conv.Zero()
|
||||||
}
|
}
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
rv.Set(conv.GoValueOf(v))
|
rv.Set(conv.GoValueOf(v))
|
||||||
if fs.Type.Kind() == reflect.Ptr && rv.IsNil() {
|
if fs.Type.Kind() == reflect.Ptr && rv.IsNil() {
|
||||||
panic(fmt.Sprintf("field %v has invalid nil pointer", fd.FullName()))
|
panic(fmt.Sprintf("field %v has invalid nil pointer", fd.FullName()))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutable: func(p pointer) pref.Value {
|
mutable: func(p pointer) protoreflect.Value {
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
if fs.Type.Kind() == reflect.Ptr && rv.IsNil() {
|
if fs.Type.Kind() == reflect.Ptr && rv.IsNil() {
|
||||||
rv.Set(conv.GoValueOf(conv.New()))
|
rv.Set(conv.GoValueOf(conv.New()))
|
||||||
}
|
}
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
newMessage: func() pref.Message {
|
newMessage: func() protoreflect.Message {
|
||||||
return conv.New().Message()
|
return conv.New().Message()
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
return conv.New()
|
return conv.New()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type oneofInfo struct {
|
type oneofInfo struct {
|
||||||
oneofDesc pref.OneofDescriptor
|
oneofDesc protoreflect.OneofDescriptor
|
||||||
which func(pointer) pref.FieldNumber
|
which func(pointer) protoreflect.FieldNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeOneofInfo(od pref.OneofDescriptor, si structInfo, x exporter) *oneofInfo {
|
func makeOneofInfo(od protoreflect.OneofDescriptor, si structInfo, x exporter) *oneofInfo {
|
||||||
oi := &oneofInfo{oneofDesc: od}
|
oi := &oneofInfo{oneofDesc: od}
|
||||||
if od.IsSynthetic() {
|
if od.IsSynthetic() {
|
||||||
fs := si.fieldsByNumber[od.Fields().Get(0).Number()]
|
fs := si.fieldsByNumber[od.Fields().Get(0).Number()]
|
||||||
fieldOffset := offsetOf(fs, x)
|
fieldOffset := offsetOf(fs, x)
|
||||||
oi.which = func(p pointer) pref.FieldNumber {
|
oi.which = func(p pointer) protoreflect.FieldNumber {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
@ -486,7 +486,7 @@ func makeOneofInfo(od pref.OneofDescriptor, si structInfo, x exporter) *oneofInf
|
||||||
} else {
|
} else {
|
||||||
fs := si.oneofsByName[od.Name()]
|
fs := si.oneofsByName[od.Name()]
|
||||||
fieldOffset := offsetOf(fs, x)
|
fieldOffset := offsetOf(fs, x)
|
||||||
oi.which = func(p pointer) pref.FieldNumber {
|
oi.which = func(p pointer) protoreflect.FieldNumber {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
@ -538,6 +538,6 @@ func isZero(v reflect.Value) bool {
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
panic(&reflect.ValueError{"reflect.Value.IsZero", v.Kind()})
|
panic(&reflect.ValueError{Method: "reflect.Value.IsZero", Kind: v.Kind()})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
142
vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go
generated
vendored
142
vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go
generated
vendored
|
|
@ -27,8 +27,9 @@ func (m *messageState) protoUnwrap() interface{} {
|
||||||
return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())
|
return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())
|
||||||
}
|
}
|
||||||
func (m *messageState) ProtoMethods() *protoiface.Methods {
|
func (m *messageState) ProtoMethods() *protoiface.Methods {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
return &m.messageInfo().methods
|
mi.init()
|
||||||
|
return &mi.methods
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code
|
// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code
|
||||||
|
|
@ -41,8 +42,9 @@ func (m *messageState) ProtoMessageInfo() *MessageInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
func (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
for _, ri := range m.messageInfo().rangeInfos {
|
mi.init()
|
||||||
|
for _, ri := range mi.rangeInfos {
|
||||||
switch ri := ri.(type) {
|
switch ri := ri.(type) {
|
||||||
case *fieldInfo:
|
case *fieldInfo:
|
||||||
if ri.has(m.pointer()) {
|
if ri.has(m.pointer()) {
|
||||||
|
|
@ -52,77 +54,86 @@ func (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.V
|
||||||
}
|
}
|
||||||
case *oneofInfo:
|
case *oneofInfo:
|
||||||
if n := ri.which(m.pointer()); n > 0 {
|
if n := ri.which(m.pointer()); n > 0 {
|
||||||
fi := m.messageInfo().fields[n]
|
fi := mi.fields[n]
|
||||||
if !f(fi.fieldDesc, fi.get(m.pointer())) {
|
if !f(fi.fieldDesc, fi.get(m.pointer())) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.messageInfo().extensionMap(m.pointer()).Range(f)
|
mi.extensionMap(m.pointer()).Range(f)
|
||||||
}
|
}
|
||||||
func (m *messageState) Has(fd protoreflect.FieldDescriptor) bool {
|
func (m *messageState) Has(fd protoreflect.FieldDescriptor) bool {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
mi.init()
|
||||||
|
if fi, xd := mi.checkField(fd); fi != nil {
|
||||||
return fi.has(m.pointer())
|
return fi.has(m.pointer())
|
||||||
} else {
|
} else {
|
||||||
return m.messageInfo().extensionMap(m.pointer()).Has(xt)
|
return mi.extensionMap(m.pointer()).Has(xd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageState) Clear(fd protoreflect.FieldDescriptor) {
|
func (m *messageState) Clear(fd protoreflect.FieldDescriptor) {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
mi.init()
|
||||||
|
if fi, xd := mi.checkField(fd); fi != nil {
|
||||||
fi.clear(m.pointer())
|
fi.clear(m.pointer())
|
||||||
} else {
|
} else {
|
||||||
m.messageInfo().extensionMap(m.pointer()).Clear(xt)
|
mi.extensionMap(m.pointer()).Clear(xd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageState) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
func (m *messageState) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
mi.init()
|
||||||
|
if fi, xd := mi.checkField(fd); fi != nil {
|
||||||
return fi.get(m.pointer())
|
return fi.get(m.pointer())
|
||||||
} else {
|
} else {
|
||||||
return m.messageInfo().extensionMap(m.pointer()).Get(xt)
|
return mi.extensionMap(m.pointer()).Get(xd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageState) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {
|
func (m *messageState) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
mi.init()
|
||||||
|
if fi, xd := mi.checkField(fd); fi != nil {
|
||||||
fi.set(m.pointer(), v)
|
fi.set(m.pointer(), v)
|
||||||
} else {
|
} else {
|
||||||
m.messageInfo().extensionMap(m.pointer()).Set(xt, v)
|
mi.extensionMap(m.pointer()).Set(xd, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
func (m *messageState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
mi.init()
|
||||||
|
if fi, xd := mi.checkField(fd); fi != nil {
|
||||||
return fi.mutable(m.pointer())
|
return fi.mutable(m.pointer())
|
||||||
} else {
|
} else {
|
||||||
return m.messageInfo().extensionMap(m.pointer()).Mutable(xt)
|
return mi.extensionMap(m.pointer()).Mutable(xd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
func (m *messageState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
mi.init()
|
||||||
|
if fi, xd := mi.checkField(fd); fi != nil {
|
||||||
return fi.newField()
|
return fi.newField()
|
||||||
} else {
|
} else {
|
||||||
return xt.New()
|
return xd.Type().New()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageState) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
func (m *messageState) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {
|
mi.init()
|
||||||
|
if oi := mi.oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {
|
||||||
return od.Fields().ByNumber(oi.which(m.pointer()))
|
return od.Fields().ByNumber(oi.which(m.pointer()))
|
||||||
}
|
}
|
||||||
panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName()))
|
panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m *messageState) GetUnknown() protoreflect.RawFields {
|
func (m *messageState) GetUnknown() protoreflect.RawFields {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
return m.messageInfo().getUnknown(m.pointer())
|
mi.init()
|
||||||
|
return mi.getUnknown(m.pointer())
|
||||||
}
|
}
|
||||||
func (m *messageState) SetUnknown(b protoreflect.RawFields) {
|
func (m *messageState) SetUnknown(b protoreflect.RawFields) {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
m.messageInfo().setUnknown(m.pointer(), b)
|
mi.init()
|
||||||
|
mi.setUnknown(m.pointer(), b)
|
||||||
}
|
}
|
||||||
func (m *messageState) IsValid() bool {
|
func (m *messageState) IsValid() bool {
|
||||||
return !m.pointer().IsNil()
|
return !m.pointer().IsNil()
|
||||||
|
|
@ -147,8 +158,9 @@ func (m *messageReflectWrapper) protoUnwrap() interface{} {
|
||||||
return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())
|
return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())
|
||||||
}
|
}
|
||||||
func (m *messageReflectWrapper) ProtoMethods() *protoiface.Methods {
|
func (m *messageReflectWrapper) ProtoMethods() *protoiface.Methods {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
return &m.messageInfo().methods
|
mi.init()
|
||||||
|
return &mi.methods
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code
|
// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code
|
||||||
|
|
@ -161,8 +173,9 @@ func (m *messageReflectWrapper) ProtoMessageInfo() *MessageInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
func (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
for _, ri := range m.messageInfo().rangeInfos {
|
mi.init()
|
||||||
|
for _, ri := range mi.rangeInfos {
|
||||||
switch ri := ri.(type) {
|
switch ri := ri.(type) {
|
||||||
case *fieldInfo:
|
case *fieldInfo:
|
||||||
if ri.has(m.pointer()) {
|
if ri.has(m.pointer()) {
|
||||||
|
|
@ -172,77 +185,86 @@ func (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, proto
|
||||||
}
|
}
|
||||||
case *oneofInfo:
|
case *oneofInfo:
|
||||||
if n := ri.which(m.pointer()); n > 0 {
|
if n := ri.which(m.pointer()); n > 0 {
|
||||||
fi := m.messageInfo().fields[n]
|
fi := mi.fields[n]
|
||||||
if !f(fi.fieldDesc, fi.get(m.pointer())) {
|
if !f(fi.fieldDesc, fi.get(m.pointer())) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.messageInfo().extensionMap(m.pointer()).Range(f)
|
mi.extensionMap(m.pointer()).Range(f)
|
||||||
}
|
}
|
||||||
func (m *messageReflectWrapper) Has(fd protoreflect.FieldDescriptor) bool {
|
func (m *messageReflectWrapper) Has(fd protoreflect.FieldDescriptor) bool {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
mi.init()
|
||||||
|
if fi, xd := mi.checkField(fd); fi != nil {
|
||||||
return fi.has(m.pointer())
|
return fi.has(m.pointer())
|
||||||
} else {
|
} else {
|
||||||
return m.messageInfo().extensionMap(m.pointer()).Has(xt)
|
return mi.extensionMap(m.pointer()).Has(xd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageReflectWrapper) Clear(fd protoreflect.FieldDescriptor) {
|
func (m *messageReflectWrapper) Clear(fd protoreflect.FieldDescriptor) {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
mi.init()
|
||||||
|
if fi, xd := mi.checkField(fd); fi != nil {
|
||||||
fi.clear(m.pointer())
|
fi.clear(m.pointer())
|
||||||
} else {
|
} else {
|
||||||
m.messageInfo().extensionMap(m.pointer()).Clear(xt)
|
mi.extensionMap(m.pointer()).Clear(xd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageReflectWrapper) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
func (m *messageReflectWrapper) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
mi.init()
|
||||||
|
if fi, xd := mi.checkField(fd); fi != nil {
|
||||||
return fi.get(m.pointer())
|
return fi.get(m.pointer())
|
||||||
} else {
|
} else {
|
||||||
return m.messageInfo().extensionMap(m.pointer()).Get(xt)
|
return mi.extensionMap(m.pointer()).Get(xd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageReflectWrapper) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {
|
func (m *messageReflectWrapper) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
mi.init()
|
||||||
|
if fi, xd := mi.checkField(fd); fi != nil {
|
||||||
fi.set(m.pointer(), v)
|
fi.set(m.pointer(), v)
|
||||||
} else {
|
} else {
|
||||||
m.messageInfo().extensionMap(m.pointer()).Set(xt, v)
|
mi.extensionMap(m.pointer()).Set(xd, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageReflectWrapper) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
func (m *messageReflectWrapper) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
mi.init()
|
||||||
|
if fi, xd := mi.checkField(fd); fi != nil {
|
||||||
return fi.mutable(m.pointer())
|
return fi.mutable(m.pointer())
|
||||||
} else {
|
} else {
|
||||||
return m.messageInfo().extensionMap(m.pointer()).Mutable(xt)
|
return mi.extensionMap(m.pointer()).Mutable(xd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageReflectWrapper) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
func (m *messageReflectWrapper) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if fi, xt := m.messageInfo().checkField(fd); fi != nil {
|
mi.init()
|
||||||
|
if fi, xd := mi.checkField(fd); fi != nil {
|
||||||
return fi.newField()
|
return fi.newField()
|
||||||
} else {
|
} else {
|
||||||
return xt.New()
|
return xd.Type().New()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageReflectWrapper) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
func (m *messageReflectWrapper) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {
|
mi.init()
|
||||||
|
if oi := mi.oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {
|
||||||
return od.Fields().ByNumber(oi.which(m.pointer()))
|
return od.Fields().ByNumber(oi.which(m.pointer()))
|
||||||
}
|
}
|
||||||
panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName()))
|
panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m *messageReflectWrapper) GetUnknown() protoreflect.RawFields {
|
func (m *messageReflectWrapper) GetUnknown() protoreflect.RawFields {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
return m.messageInfo().getUnknown(m.pointer())
|
mi.init()
|
||||||
|
return mi.getUnknown(m.pointer())
|
||||||
}
|
}
|
||||||
func (m *messageReflectWrapper) SetUnknown(b protoreflect.RawFields) {
|
func (m *messageReflectWrapper) SetUnknown(b protoreflect.RawFields) {
|
||||||
m.messageInfo().init()
|
mi := m.messageInfo()
|
||||||
m.messageInfo().setUnknown(m.pointer(), b)
|
mi.init()
|
||||||
|
mi.setUnknown(m.pointer(), b)
|
||||||
}
|
}
|
||||||
func (m *messageReflectWrapper) IsValid() bool {
|
func (m *messageReflectWrapper) IsValid() bool {
|
||||||
return !m.pointer().IsNil()
|
return !m.pointer().IsNil()
|
||||||
|
|
|
||||||
37
vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go
generated
vendored
37
vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build purego || appengine
|
||||||
// +build purego appengine
|
// +build purego appengine
|
||||||
|
|
||||||
package impl
|
package impl
|
||||||
|
|
@ -158,6 +159,42 @@ func (p pointer) SetPointer(v pointer) {
|
||||||
p.v.Elem().Set(v.v)
|
p.v.Elem().Set(v.v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func growSlice(p pointer, addCap int) {
|
||||||
|
// TODO: Once we only support Go 1.20 and newer, use reflect.Grow.
|
||||||
|
in := p.v.Elem()
|
||||||
|
out := reflect.MakeSlice(in.Type(), in.Len(), in.Len()+addCap)
|
||||||
|
reflect.Copy(out, in)
|
||||||
|
p.v.Elem().Set(out)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growBoolSlice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growInt32Slice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growUint32Slice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growInt64Slice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growUint64Slice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growFloat64Slice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growFloat32Slice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
func (Export) MessageStateOf(p Pointer) *messageState { panic("not supported") }
|
func (Export) MessageStateOf(p Pointer) *messageState { panic("not supported") }
|
||||||
func (ms *messageState) pointer() pointer { panic("not supported") }
|
func (ms *messageState) pointer() pointer { panic("not supported") }
|
||||||
func (ms *messageState) messageInfo() *MessageInfo { panic("not supported") }
|
func (ms *messageState) messageInfo() *MessageInfo { panic("not supported") }
|
||||||
|
|
|
||||||
41
vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go
generated
vendored
41
vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !purego && !appengine
|
||||||
// +build !purego,!appengine
|
// +build !purego,!appengine
|
||||||
|
|
||||||
package impl
|
package impl
|
||||||
|
|
@ -137,6 +138,46 @@ func (p pointer) SetPointer(v pointer) {
|
||||||
*(*unsafe.Pointer)(p.p) = (unsafe.Pointer)(v.p)
|
*(*unsafe.Pointer)(p.p) = (unsafe.Pointer)(v.p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p pointer) growBoolSlice(addCap int) {
|
||||||
|
sp := p.BoolSlice()
|
||||||
|
s := make([]bool, 0, addCap+len(*sp))
|
||||||
|
s = s[:len(*sp)]
|
||||||
|
copy(s, *sp)
|
||||||
|
*sp = s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growInt32Slice(addCap int) {
|
||||||
|
sp := p.Int32Slice()
|
||||||
|
s := make([]int32, 0, addCap+len(*sp))
|
||||||
|
s = s[:len(*sp)]
|
||||||
|
copy(s, *sp)
|
||||||
|
*sp = s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growUint32Slice(addCap int) {
|
||||||
|
p.growInt32Slice(addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growFloat32Slice(addCap int) {
|
||||||
|
p.growInt32Slice(addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growInt64Slice(addCap int) {
|
||||||
|
sp := p.Int64Slice()
|
||||||
|
s := make([]int64, 0, addCap+len(*sp))
|
||||||
|
s = s[:len(*sp)]
|
||||||
|
copy(s, *sp)
|
||||||
|
*sp = s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growUint64Slice(addCap int) {
|
||||||
|
p.growInt64Slice(addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growFloat64Slice(addCap int) {
|
||||||
|
p.growInt64Slice(addCap)
|
||||||
|
}
|
||||||
|
|
||||||
// Static check that MessageState does not exceed the size of a pointer.
|
// Static check that MessageState does not exceed the size of a pointer.
|
||||||
const _ = uint(unsafe.Sizeof(unsafe.Pointer(nil)) - unsafe.Sizeof(MessageState{}))
|
const _ = uint(unsafe.Sizeof(unsafe.Pointer(nil)) - unsafe.Sizeof(MessageState{}))
|
||||||
|
|
||||||
|
|
|
||||||
50
vendor/google.golang.org/protobuf/internal/impl/validate.go
generated
vendored
50
vendor/google.golang.org/protobuf/internal/impl/validate.go
generated
vendored
|
|
@ -16,9 +16,9 @@ import (
|
||||||
"google.golang.org/protobuf/internal/flags"
|
"google.golang.org/protobuf/internal/flags"
|
||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ValidationStatus is the result of validating the wire-format encoding of a message.
|
// ValidationStatus is the result of validating the wire-format encoding of a message.
|
||||||
|
|
@ -56,20 +56,20 @@ func (v ValidationStatus) String() string {
|
||||||
// of the message type.
|
// of the message type.
|
||||||
//
|
//
|
||||||
// This function is exposed for testing.
|
// This function is exposed for testing.
|
||||||
func Validate(mt pref.MessageType, in piface.UnmarshalInput) (out piface.UnmarshalOutput, _ ValidationStatus) {
|
func Validate(mt protoreflect.MessageType, in protoiface.UnmarshalInput) (out protoiface.UnmarshalOutput, _ ValidationStatus) {
|
||||||
mi, ok := mt.(*MessageInfo)
|
mi, ok := mt.(*MessageInfo)
|
||||||
if !ok {
|
if !ok {
|
||||||
return out, ValidationUnknown
|
return out, ValidationUnknown
|
||||||
}
|
}
|
||||||
if in.Resolver == nil {
|
if in.Resolver == nil {
|
||||||
in.Resolver = preg.GlobalTypes
|
in.Resolver = protoregistry.GlobalTypes
|
||||||
}
|
}
|
||||||
o, st := mi.validate(in.Buf, 0, unmarshalOptions{
|
o, st := mi.validate(in.Buf, 0, unmarshalOptions{
|
||||||
flags: in.Flags,
|
flags: in.Flags,
|
||||||
resolver: in.Resolver,
|
resolver: in.Resolver,
|
||||||
})
|
})
|
||||||
if o.initialized {
|
if o.initialized {
|
||||||
out.Flags |= piface.UnmarshalInitialized
|
out.Flags |= protoiface.UnmarshalInitialized
|
||||||
}
|
}
|
||||||
return out, st
|
return out, st
|
||||||
}
|
}
|
||||||
|
|
@ -106,22 +106,22 @@ const (
|
||||||
validationTypeMessageSetItem
|
validationTypeMessageSetItem
|
||||||
)
|
)
|
||||||
|
|
||||||
func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd pref.FieldDescriptor, ft reflect.Type) validationInfo {
|
func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd protoreflect.FieldDescriptor, ft reflect.Type) validationInfo {
|
||||||
var vi validationInfo
|
var vi validationInfo
|
||||||
switch {
|
switch {
|
||||||
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
|
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
vi.typ = validationTypeMessage
|
vi.typ = validationTypeMessage
|
||||||
if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {
|
if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {
|
||||||
vi.mi = getMessageInfo(ot.Field(0).Type)
|
vi.mi = getMessageInfo(ot.Field(0).Type)
|
||||||
}
|
}
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
vi.typ = validationTypeGroup
|
vi.typ = validationTypeGroup
|
||||||
if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {
|
if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {
|
||||||
vi.mi = getMessageInfo(ot.Field(0).Type)
|
vi.mi = getMessageInfo(ot.Field(0).Type)
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if strs.EnforceUTF8(fd) {
|
if strs.EnforceUTF8(fd) {
|
||||||
vi.typ = validationTypeUTF8String
|
vi.typ = validationTypeUTF8String
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +129,7 @@ func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd pref.FieldDescrip
|
||||||
default:
|
default:
|
||||||
vi = newValidationInfo(fd, ft)
|
vi = newValidationInfo(fd, ft)
|
||||||
}
|
}
|
||||||
if fd.Cardinality() == pref.Required {
|
if fd.Cardinality() == protoreflect.Required {
|
||||||
// Avoid overflow. The required field check is done with a 64-bit mask, with
|
// Avoid overflow. The required field check is done with a 64-bit mask, with
|
||||||
// any message containing more than 64 required fields always reported as
|
// any message containing more than 64 required fields always reported as
|
||||||
// potentially uninitialized, so it is not important to get a precise count
|
// potentially uninitialized, so it is not important to get a precise count
|
||||||
|
|
@ -142,22 +142,22 @@ func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd pref.FieldDescrip
|
||||||
return vi
|
return vi
|
||||||
}
|
}
|
||||||
|
|
||||||
func newValidationInfo(fd pref.FieldDescriptor, ft reflect.Type) validationInfo {
|
func newValidationInfo(fd protoreflect.FieldDescriptor, ft reflect.Type) validationInfo {
|
||||||
var vi validationInfo
|
var vi validationInfo
|
||||||
switch {
|
switch {
|
||||||
case fd.IsList():
|
case fd.IsList():
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
vi.typ = validationTypeMessage
|
vi.typ = validationTypeMessage
|
||||||
if ft.Kind() == reflect.Slice {
|
if ft.Kind() == reflect.Slice {
|
||||||
vi.mi = getMessageInfo(ft.Elem())
|
vi.mi = getMessageInfo(ft.Elem())
|
||||||
}
|
}
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
vi.typ = validationTypeGroup
|
vi.typ = validationTypeGroup
|
||||||
if ft.Kind() == reflect.Slice {
|
if ft.Kind() == reflect.Slice {
|
||||||
vi.mi = getMessageInfo(ft.Elem())
|
vi.mi = getMessageInfo(ft.Elem())
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
vi.typ = validationTypeBytes
|
vi.typ = validationTypeBytes
|
||||||
if strs.EnforceUTF8(fd) {
|
if strs.EnforceUTF8(fd) {
|
||||||
vi.typ = validationTypeUTF8String
|
vi.typ = validationTypeUTF8String
|
||||||
|
|
@ -175,33 +175,33 @@ func newValidationInfo(fd pref.FieldDescriptor, ft reflect.Type) validationInfo
|
||||||
case fd.IsMap():
|
case fd.IsMap():
|
||||||
vi.typ = validationTypeMap
|
vi.typ = validationTypeMap
|
||||||
switch fd.MapKey().Kind() {
|
switch fd.MapKey().Kind() {
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if strs.EnforceUTF8(fd) {
|
if strs.EnforceUTF8(fd) {
|
||||||
vi.keyType = validationTypeUTF8String
|
vi.keyType = validationTypeUTF8String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch fd.MapValue().Kind() {
|
switch fd.MapValue().Kind() {
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
vi.valType = validationTypeMessage
|
vi.valType = validationTypeMessage
|
||||||
if ft.Kind() == reflect.Map {
|
if ft.Kind() == reflect.Map {
|
||||||
vi.mi = getMessageInfo(ft.Elem())
|
vi.mi = getMessageInfo(ft.Elem())
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if strs.EnforceUTF8(fd) {
|
if strs.EnforceUTF8(fd) {
|
||||||
vi.valType = validationTypeUTF8String
|
vi.valType = validationTypeUTF8String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
vi.typ = validationTypeMessage
|
vi.typ = validationTypeMessage
|
||||||
if !fd.IsWeak() {
|
if !fd.IsWeak() {
|
||||||
vi.mi = getMessageInfo(ft)
|
vi.mi = getMessageInfo(ft)
|
||||||
}
|
}
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
vi.typ = validationTypeGroup
|
vi.typ = validationTypeGroup
|
||||||
vi.mi = getMessageInfo(ft)
|
vi.mi = getMessageInfo(ft)
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
vi.typ = validationTypeBytes
|
vi.typ = validationTypeBytes
|
||||||
if strs.EnforceUTF8(fd) {
|
if strs.EnforceUTF8(fd) {
|
||||||
vi.typ = validationTypeUTF8String
|
vi.typ = validationTypeUTF8String
|
||||||
|
|
@ -314,11 +314,11 @@ State:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
messageName := fd.Message().FullName()
|
messageName := fd.Message().FullName()
|
||||||
messageType, err := preg.GlobalTypes.FindMessageByName(messageName)
|
messageType, err := protoregistry.GlobalTypes.FindMessageByName(messageName)
|
||||||
switch err {
|
switch err {
|
||||||
case nil:
|
case nil:
|
||||||
vi.mi, _ = messageType.(*MessageInfo)
|
vi.mi, _ = messageType.(*MessageInfo)
|
||||||
case preg.NotFound:
|
case protoregistry.NotFound:
|
||||||
vi.typ = validationTypeBytes
|
vi.typ = validationTypeBytes
|
||||||
default:
|
default:
|
||||||
return out, ValidationUnknown
|
return out, ValidationUnknown
|
||||||
|
|
@ -335,7 +335,7 @@ State:
|
||||||
// unmarshaling to begin failing. Supporting this requires some way to
|
// unmarshaling to begin failing. Supporting this requires some way to
|
||||||
// determine if the resolver is frozen.
|
// determine if the resolver is frozen.
|
||||||
xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), num)
|
xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), num)
|
||||||
if err != nil && err != preg.NotFound {
|
if err != nil && err != protoregistry.NotFound {
|
||||||
return out, ValidationUnknown
|
return out, ValidationUnknown
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
@ -513,7 +513,7 @@ State:
|
||||||
}
|
}
|
||||||
xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), typeid)
|
xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), typeid)
|
||||||
switch {
|
switch {
|
||||||
case err == preg.NotFound:
|
case err == protoregistry.NotFound:
|
||||||
b = b[n:]
|
b = b[n:]
|
||||||
case err != nil:
|
case err != nil:
|
||||||
return out, ValidationUnknown
|
return out, ValidationUnknown
|
||||||
|
|
|
||||||
16
vendor/google.golang.org/protobuf/internal/impl/weak.go
generated
vendored
16
vendor/google.golang.org/protobuf/internal/impl/weak.go
generated
vendored
|
|
@ -7,7 +7,7 @@ package impl
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -17,32 +17,32 @@ import (
|
||||||
// defined directly on it.
|
// defined directly on it.
|
||||||
type weakFields WeakFields
|
type weakFields WeakFields
|
||||||
|
|
||||||
func (w weakFields) get(num pref.FieldNumber) (pref.ProtoMessage, bool) {
|
func (w weakFields) get(num protoreflect.FieldNumber) (protoreflect.ProtoMessage, bool) {
|
||||||
m, ok := w[int32(num)]
|
m, ok := w[int32(num)]
|
||||||
return m, ok
|
return m, ok
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *weakFields) set(num pref.FieldNumber, m pref.ProtoMessage) {
|
func (w *weakFields) set(num protoreflect.FieldNumber, m protoreflect.ProtoMessage) {
|
||||||
if *w == nil {
|
if *w == nil {
|
||||||
*w = make(weakFields)
|
*w = make(weakFields)
|
||||||
}
|
}
|
||||||
(*w)[int32(num)] = m
|
(*w)[int32(num)] = m
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *weakFields) clear(num pref.FieldNumber) {
|
func (w *weakFields) clear(num protoreflect.FieldNumber) {
|
||||||
delete(*w, int32(num))
|
delete(*w, int32(num))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Export) HasWeak(w WeakFields, num pref.FieldNumber) bool {
|
func (Export) HasWeak(w WeakFields, num protoreflect.FieldNumber) bool {
|
||||||
_, ok := w[int32(num)]
|
_, ok := w[int32(num)]
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Export) ClearWeak(w *WeakFields, num pref.FieldNumber) {
|
func (Export) ClearWeak(w *WeakFields, num protoreflect.FieldNumber) {
|
||||||
delete(*w, int32(num))
|
delete(*w, int32(num))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Export) GetWeak(w WeakFields, num pref.FieldNumber, name pref.FullName) pref.ProtoMessage {
|
func (Export) GetWeak(w WeakFields, num protoreflect.FieldNumber, name protoreflect.FullName) protoreflect.ProtoMessage {
|
||||||
if m, ok := w[int32(num)]; ok {
|
if m, ok := w[int32(num)]; ok {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
@ -53,7 +53,7 @@ func (Export) GetWeak(w WeakFields, num pref.FieldNumber, name pref.FullName) pr
|
||||||
return mt.Zero().Interface()
|
return mt.Zero().Interface()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Export) SetWeak(w *WeakFields, num pref.FieldNumber, name pref.FullName, m pref.ProtoMessage) {
|
func (Export) SetWeak(w *WeakFields, num protoreflect.FieldNumber, name protoreflect.FullName, m protoreflect.ProtoMessage) {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
mt, _ := protoregistry.GlobalTypes.FindMessageByName(name)
|
mt, _ := protoregistry.GlobalTypes.FindMessageByName(name)
|
||||||
if mt == nil {
|
if mt == nil {
|
||||||
|
|
|
||||||
18
vendor/google.golang.org/protobuf/internal/order/order.go
generated
vendored
18
vendor/google.golang.org/protobuf/internal/order/order.go
generated
vendored
|
|
@ -5,12 +5,12 @@
|
||||||
package order
|
package order
|
||||||
|
|
||||||
import (
|
import (
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FieldOrder specifies the ordering to visit message fields.
|
// FieldOrder specifies the ordering to visit message fields.
|
||||||
// It is a function that reports whether x is ordered before y.
|
// It is a function that reports whether x is ordered before y.
|
||||||
type FieldOrder func(x, y pref.FieldDescriptor) bool
|
type FieldOrder func(x, y protoreflect.FieldDescriptor) bool
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// AnyFieldOrder specifies no specific field ordering.
|
// AnyFieldOrder specifies no specific field ordering.
|
||||||
|
|
@ -18,9 +18,9 @@ var (
|
||||||
|
|
||||||
// LegacyFieldOrder sorts fields in the same ordering as emitted by
|
// LegacyFieldOrder sorts fields in the same ordering as emitted by
|
||||||
// wire serialization in the github.com/golang/protobuf implementation.
|
// wire serialization in the github.com/golang/protobuf implementation.
|
||||||
LegacyFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {
|
LegacyFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
|
||||||
ox, oy := x.ContainingOneof(), y.ContainingOneof()
|
ox, oy := x.ContainingOneof(), y.ContainingOneof()
|
||||||
inOneof := func(od pref.OneofDescriptor) bool {
|
inOneof := func(od protoreflect.OneofDescriptor) bool {
|
||||||
return od != nil && !od.IsSynthetic()
|
return od != nil && !od.IsSynthetic()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ var (
|
||||||
return !inOneof(ox) && inOneof(oy)
|
return !inOneof(ox) && inOneof(oy)
|
||||||
}
|
}
|
||||||
// Fields in disjoint oneof sets are sorted by declaration index.
|
// Fields in disjoint oneof sets are sorted by declaration index.
|
||||||
if ox != nil && oy != nil && ox != oy {
|
if inOneof(ox) && inOneof(oy) && ox != oy {
|
||||||
return ox.Index() < oy.Index()
|
return ox.Index() < oy.Index()
|
||||||
}
|
}
|
||||||
// Fields sorted by field number.
|
// Fields sorted by field number.
|
||||||
|
|
@ -41,14 +41,14 @@ var (
|
||||||
}
|
}
|
||||||
|
|
||||||
// NumberFieldOrder sorts fields by their field number.
|
// NumberFieldOrder sorts fields by their field number.
|
||||||
NumberFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {
|
NumberFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
|
||||||
return x.Number() < y.Number()
|
return x.Number() < y.Number()
|
||||||
}
|
}
|
||||||
|
|
||||||
// IndexNameFieldOrder sorts non-extension fields before extension fields.
|
// IndexNameFieldOrder sorts non-extension fields before extension fields.
|
||||||
// Non-extensions are sorted according to their declaration index.
|
// Non-extensions are sorted according to their declaration index.
|
||||||
// Extensions are sorted according to their full name.
|
// Extensions are sorted according to their full name.
|
||||||
IndexNameFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {
|
IndexNameFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
|
||||||
// Non-extension fields sort before extension fields.
|
// Non-extension fields sort before extension fields.
|
||||||
if x.IsExtension() != y.IsExtension() {
|
if x.IsExtension() != y.IsExtension() {
|
||||||
return !x.IsExtension() && y.IsExtension()
|
return !x.IsExtension() && y.IsExtension()
|
||||||
|
|
@ -64,7 +64,7 @@ var (
|
||||||
|
|
||||||
// KeyOrder specifies the ordering to visit map entries.
|
// KeyOrder specifies the ordering to visit map entries.
|
||||||
// It is a function that reports whether x is ordered before y.
|
// It is a function that reports whether x is ordered before y.
|
||||||
type KeyOrder func(x, y pref.MapKey) bool
|
type KeyOrder func(x, y protoreflect.MapKey) bool
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// AnyKeyOrder specifies no specific key ordering.
|
// AnyKeyOrder specifies no specific key ordering.
|
||||||
|
|
@ -72,7 +72,7 @@ var (
|
||||||
|
|
||||||
// GenericKeyOrder sorts false before true, numeric keys in ascending order,
|
// GenericKeyOrder sorts false before true, numeric keys in ascending order,
|
||||||
// and strings in lexicographical ordering according to UTF-8 codepoints.
|
// and strings in lexicographical ordering according to UTF-8 codepoints.
|
||||||
GenericKeyOrder KeyOrder = func(x, y pref.MapKey) bool {
|
GenericKeyOrder KeyOrder = func(x, y protoreflect.MapKey) bool {
|
||||||
switch x.Interface().(type) {
|
switch x.Interface().(type) {
|
||||||
case bool:
|
case bool:
|
||||||
return !x.Bool() && y.Bool()
|
return !x.Bool() && y.Bool()
|
||||||
|
|
|
||||||
22
vendor/google.golang.org/protobuf/internal/order/range.go
generated
vendored
22
vendor/google.golang.org/protobuf/internal/order/range.go
generated
vendored
|
|
@ -9,12 +9,12 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type messageField struct {
|
type messageField struct {
|
||||||
fd pref.FieldDescriptor
|
fd protoreflect.FieldDescriptor
|
||||||
v pref.Value
|
v protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
var messageFieldPool = sync.Pool{
|
var messageFieldPool = sync.Pool{
|
||||||
|
|
@ -25,8 +25,8 @@ type (
|
||||||
// FieldRnger is an interface for visiting all fields in a message.
|
// FieldRnger is an interface for visiting all fields in a message.
|
||||||
// The protoreflect.Message type implements this interface.
|
// The protoreflect.Message type implements this interface.
|
||||||
FieldRanger interface{ Range(VisitField) }
|
FieldRanger interface{ Range(VisitField) }
|
||||||
// VisitField is called everytime a message field is visited.
|
// VisitField is called every time a message field is visited.
|
||||||
VisitField = func(pref.FieldDescriptor, pref.Value) bool
|
VisitField = func(protoreflect.FieldDescriptor, protoreflect.Value) bool
|
||||||
)
|
)
|
||||||
|
|
||||||
// RangeFields iterates over the fields of fs according to the specified order.
|
// RangeFields iterates over the fields of fs according to the specified order.
|
||||||
|
|
@ -47,7 +47,7 @@ func RangeFields(fs FieldRanger, less FieldOrder, fn VisitField) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Collect all fields in the message and sort them.
|
// Collect all fields in the message and sort them.
|
||||||
fs.Range(func(fd pref.FieldDescriptor, v pref.Value) bool {
|
fs.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
|
||||||
fields = append(fields, messageField{fd, v})
|
fields = append(fields, messageField{fd, v})
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
@ -64,8 +64,8 @@ func RangeFields(fs FieldRanger, less FieldOrder, fn VisitField) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type mapEntry struct {
|
type mapEntry struct {
|
||||||
k pref.MapKey
|
k protoreflect.MapKey
|
||||||
v pref.Value
|
v protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapEntryPool = sync.Pool{
|
var mapEntryPool = sync.Pool{
|
||||||
|
|
@ -76,8 +76,8 @@ type (
|
||||||
// EntryRanger is an interface for visiting all fields in a message.
|
// EntryRanger is an interface for visiting all fields in a message.
|
||||||
// The protoreflect.Map type implements this interface.
|
// The protoreflect.Map type implements this interface.
|
||||||
EntryRanger interface{ Range(VisitEntry) }
|
EntryRanger interface{ Range(VisitEntry) }
|
||||||
// VisitEntry is called everytime a map entry is visited.
|
// VisitEntry is called every time a map entry is visited.
|
||||||
VisitEntry = func(pref.MapKey, pref.Value) bool
|
VisitEntry = func(protoreflect.MapKey, protoreflect.Value) bool
|
||||||
)
|
)
|
||||||
|
|
||||||
// RangeEntries iterates over the entries of es according to the specified order.
|
// RangeEntries iterates over the entries of es according to the specified order.
|
||||||
|
|
@ -98,7 +98,7 @@ func RangeEntries(es EntryRanger, less KeyOrder, fn VisitEntry) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Collect all entries in the map and sort them.
|
// Collect all entries in the map and sort them.
|
||||||
es.Range(func(k pref.MapKey, v pref.Value) bool {
|
es.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {
|
||||||
entries = append(entries, mapEntry{k, v})
|
entries = append(entries, mapEntry{k, v})
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
|
||||||
2
vendor/google.golang.org/protobuf/internal/strs/strings.go
generated
vendored
2
vendor/google.golang.org/protobuf/internal/strs/strings.go
generated
vendored
|
|
@ -17,7 +17,7 @@ import (
|
||||||
|
|
||||||
// EnforceUTF8 reports whether to enforce strict UTF-8 validation.
|
// EnforceUTF8 reports whether to enforce strict UTF-8 validation.
|
||||||
func EnforceUTF8(fd protoreflect.FieldDescriptor) bool {
|
func EnforceUTF8(fd protoreflect.FieldDescriptor) bool {
|
||||||
if flags.ProtoLegacy {
|
if flags.ProtoLegacy || fd.Syntax() == protoreflect.Editions {
|
||||||
if fd, ok := fd.(interface{ EnforceUTF8() bool }); ok {
|
if fd, ok := fd.(interface{ EnforceUTF8() bool }); ok {
|
||||||
return fd.EnforceUTF8()
|
return fd.EnforceUTF8()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
vendor/google.golang.org/protobuf/internal/strs/strings_pure.go
generated
vendored
1
vendor/google.golang.org/protobuf/internal/strs/strings_pure.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build purego || appengine
|
||||||
// +build purego appengine
|
// +build purego appengine
|
||||||
|
|
||||||
package strs
|
package strs
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,15 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !purego,!appengine
|
//go:build !purego && !appengine && !go1.21
|
||||||
|
// +build !purego,!appengine,!go1.21
|
||||||
|
|
||||||
package strs
|
package strs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
@ -58,7 +59,7 @@ type Builder struct {
|
||||||
|
|
||||||
// AppendFullName is equivalent to protoreflect.FullName.Append,
|
// AppendFullName is equivalent to protoreflect.FullName.Append,
|
||||||
// but optimized for large batches where each name has a shared lifetime.
|
// but optimized for large batches where each name has a shared lifetime.
|
||||||
func (sb *Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.FullName {
|
func (sb *Builder) AppendFullName(prefix protoreflect.FullName, name protoreflect.Name) protoreflect.FullName {
|
||||||
n := len(prefix) + len(".") + len(name)
|
n := len(prefix) + len(".") + len(name)
|
||||||
if len(prefix) == 0 {
|
if len(prefix) == 0 {
|
||||||
n -= len(".")
|
n -= len(".")
|
||||||
|
|
@ -67,7 +68,7 @@ func (sb *Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.Ful
|
||||||
sb.buf = append(sb.buf, prefix...)
|
sb.buf = append(sb.buf, prefix...)
|
||||||
sb.buf = append(sb.buf, '.')
|
sb.buf = append(sb.buf, '.')
|
||||||
sb.buf = append(sb.buf, name...)
|
sb.buf = append(sb.buf, name...)
|
||||||
return pref.FullName(sb.last(n))
|
return protoreflect.FullName(sb.last(n))
|
||||||
}
|
}
|
||||||
|
|
||||||
// MakeString is equivalent to string(b), but optimized for large batches
|
// MakeString is equivalent to string(b), but optimized for large batches
|
||||||
|
|
@ -86,7 +87,7 @@ func (sb *Builder) grow(n int) {
|
||||||
// Unlike strings.Builder, we do not need to copy over the contents
|
// Unlike strings.Builder, we do not need to copy over the contents
|
||||||
// of the old buffer since our builder provides no API for
|
// of the old buffer since our builder provides no API for
|
||||||
// retrieving previously created strings.
|
// retrieving previously created strings.
|
||||||
sb.buf = make([]byte, 2*(cap(sb.buf)+n))
|
sb.buf = make([]byte, 0, 2*(cap(sb.buf)+n))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sb *Builder) last(n int) string {
|
func (sb *Builder) last(n int) string {
|
||||||
74
vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go
generated
vendored
Normal file
74
vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
// 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 !purego && !appengine && go1.21
|
||||||
|
// +build !purego,!appengine,go1.21
|
||||||
|
|
||||||
|
package strs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UnsafeString returns an unsafe string reference of b.
|
||||||
|
// The caller must treat the input slice as immutable.
|
||||||
|
//
|
||||||
|
// WARNING: Use carefully. The returned result must not leak to the end user
|
||||||
|
// unless the input slice is provably immutable.
|
||||||
|
func UnsafeString(b []byte) string {
|
||||||
|
return unsafe.String(unsafe.SliceData(b), len(b))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnsafeBytes returns an unsafe bytes slice reference of s.
|
||||||
|
// The caller must treat returned slice as immutable.
|
||||||
|
//
|
||||||
|
// WARNING: Use carefully. The returned result must not leak to the end user.
|
||||||
|
func UnsafeBytes(s string) []byte {
|
||||||
|
return unsafe.Slice(unsafe.StringData(s), len(s))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Builder builds a set of strings with shared lifetime.
|
||||||
|
// This differs from strings.Builder, which is for building a single string.
|
||||||
|
type Builder struct {
|
||||||
|
buf []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
// AppendFullName is equivalent to protoreflect.FullName.Append,
|
||||||
|
// but optimized for large batches where each name has a shared lifetime.
|
||||||
|
func (sb *Builder) AppendFullName(prefix protoreflect.FullName, name protoreflect.Name) protoreflect.FullName {
|
||||||
|
n := len(prefix) + len(".") + len(name)
|
||||||
|
if len(prefix) == 0 {
|
||||||
|
n -= len(".")
|
||||||
|
}
|
||||||
|
sb.grow(n)
|
||||||
|
sb.buf = append(sb.buf, prefix...)
|
||||||
|
sb.buf = append(sb.buf, '.')
|
||||||
|
sb.buf = append(sb.buf, name...)
|
||||||
|
return protoreflect.FullName(sb.last(n))
|
||||||
|
}
|
||||||
|
|
||||||
|
// MakeString is equivalent to string(b), but optimized for large batches
|
||||||
|
// with a shared lifetime.
|
||||||
|
func (sb *Builder) MakeString(b []byte) string {
|
||||||
|
sb.grow(len(b))
|
||||||
|
sb.buf = append(sb.buf, b...)
|
||||||
|
return sb.last(len(b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sb *Builder) grow(n int) {
|
||||||
|
if cap(sb.buf)-len(sb.buf) >= n {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unlike strings.Builder, we do not need to copy over the contents
|
||||||
|
// of the old buffer since our builder provides no API for
|
||||||
|
// retrieving previously created strings.
|
||||||
|
sb.buf = make([]byte, 0, 2*(cap(sb.buf)+n))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sb *Builder) last(n int) string {
|
||||||
|
return UnsafeString(sb.buf[len(sb.buf)-n:])
|
||||||
|
}
|
||||||
56
vendor/google.golang.org/protobuf/internal/version/version.go
generated
vendored
56
vendor/google.golang.org/protobuf/internal/version/version.go
generated
vendored
|
|
@ -12,54 +12,54 @@ import (
|
||||||
|
|
||||||
// These constants determine the current version of this module.
|
// These constants determine the current version of this module.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// For our release process, we enforce the following rules:
|
// For our release process, we enforce the following rules:
|
||||||
// * Tagged releases use a tag that is identical to String.
|
// - Tagged releases use a tag that is identical to String.
|
||||||
// * Tagged releases never reference a commit where the String
|
// - Tagged releases never reference a commit where the String
|
||||||
// contains "devel".
|
// contains "devel".
|
||||||
// * The set of all commits in this repository where String
|
// - The set of all commits in this repository where String
|
||||||
// does not contain "devel" must have a unique String.
|
// does not contain "devel" must have a unique String.
|
||||||
//
|
|
||||||
//
|
//
|
||||||
// Steps for tagging a new release:
|
// Steps for tagging a new release:
|
||||||
// 1. Create a new CL.
|
|
||||||
//
|
//
|
||||||
// 2. Update Minor, Patch, and/or PreRelease as necessary.
|
// 1. Create a new CL.
|
||||||
// PreRelease must not contain the string "devel".
|
|
||||||
//
|
//
|
||||||
// 3. Since the last released minor version, have there been any changes to
|
// 2. Update Minor, Patch, and/or PreRelease as necessary.
|
||||||
// generator that relies on new functionality in the runtime?
|
// PreRelease must not contain the string "devel".
|
||||||
// If yes, then increment RequiredGenerated.
|
|
||||||
//
|
//
|
||||||
// 4. Since the last released minor version, have there been any changes to
|
// 3. Since the last released minor version, have there been any changes to
|
||||||
// the runtime that removes support for old .pb.go source code?
|
// generator that relies on new functionality in the runtime?
|
||||||
// If yes, then increment SupportMinimum.
|
// If yes, then increment RequiredGenerated.
|
||||||
//
|
//
|
||||||
// 5. Send out the CL for review and submit it.
|
// 4. Since the last released minor version, have there been any changes to
|
||||||
// Note that the next CL in step 8 must be submitted after this CL
|
// the runtime that removes support for old .pb.go source code?
|
||||||
// without any other CLs in-between.
|
// If yes, then increment SupportMinimum.
|
||||||
//
|
//
|
||||||
// 6. Tag a new version, where the tag is is the current String.
|
// 5. Send out the CL for review and submit it.
|
||||||
|
// Note that the next CL in step 8 must be submitted after this CL
|
||||||
|
// without any other CLs in-between.
|
||||||
//
|
//
|
||||||
// 7. Write release notes for all notable changes
|
// 6. Tag a new version, where the tag is is the current String.
|
||||||
// between this release and the last release.
|
|
||||||
//
|
//
|
||||||
// 8. Create a new CL.
|
// 7. Write release notes for all notable changes
|
||||||
|
// between this release and the last release.
|
||||||
//
|
//
|
||||||
// 9. Update PreRelease to include the string "devel".
|
// 8. Create a new CL.
|
||||||
// For example: "" -> "devel" or "rc.1" -> "rc.1.devel"
|
|
||||||
//
|
//
|
||||||
// 10. Send out the CL for review and submit it.
|
// 9. Update PreRelease to include the string "devel".
|
||||||
|
// For example: "" -> "devel" or "rc.1" -> "rc.1.devel"
|
||||||
|
//
|
||||||
|
// 10. Send out the CL for review and submit it.
|
||||||
const (
|
const (
|
||||||
Major = 1
|
Major = 1
|
||||||
Minor = 26
|
Minor = 34
|
||||||
Patch = 0
|
Patch = 1
|
||||||
PreRelease = ""
|
PreRelease = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
// String formats the version string for this module in semver format.
|
// String formats the version string for this module in semver format.
|
||||||
//
|
//
|
||||||
// Examples:
|
// Examples:
|
||||||
|
//
|
||||||
// v1.20.1
|
// v1.20.1
|
||||||
// v1.21.0-rc.1
|
// v1.21.0-rc.1
|
||||||
func String() string {
|
func String() string {
|
||||||
|
|
|
||||||
24
vendor/google.golang.org/protobuf/proto/decode.go
generated
vendored
24
vendor/google.golang.org/protobuf/proto/decode.go
generated
vendored
|
|
@ -19,7 +19,8 @@ import (
|
||||||
// UnmarshalOptions configures the unmarshaler.
|
// UnmarshalOptions configures the unmarshaler.
|
||||||
//
|
//
|
||||||
// Example usage:
|
// Example usage:
|
||||||
// err := UnmarshalOptions{DiscardUnknown: true}.Unmarshal(b, m)
|
//
|
||||||
|
// err := UnmarshalOptions{DiscardUnknown: true}.Unmarshal(b, m)
|
||||||
type UnmarshalOptions struct {
|
type UnmarshalOptions struct {
|
||||||
pragma.NoUnkeyedLiterals
|
pragma.NoUnkeyedLiterals
|
||||||
|
|
||||||
|
|
@ -42,18 +43,27 @@ type UnmarshalOptions struct {
|
||||||
FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
|
FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
|
||||||
FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
|
FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RecursionLimit limits how deeply messages may be nested.
|
||||||
|
// If zero, a default limit is applied.
|
||||||
|
RecursionLimit int
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal parses the wire-format message in b and places the result in m.
|
// Unmarshal parses the wire-format message in b and places the result in m.
|
||||||
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
||||||
|
//
|
||||||
|
// See the [UnmarshalOptions] type if you need more control.
|
||||||
func Unmarshal(b []byte, m Message) error {
|
func Unmarshal(b []byte, m Message) error {
|
||||||
_, err := UnmarshalOptions{}.unmarshal(b, m.ProtoReflect())
|
_, err := UnmarshalOptions{RecursionLimit: protowire.DefaultRecursionLimit}.unmarshal(b, m.ProtoReflect())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal parses the wire-format message in b and places the result in m.
|
// Unmarshal parses the wire-format message in b and places the result in m.
|
||||||
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
||||||
func (o UnmarshalOptions) Unmarshal(b []byte, m Message) error {
|
func (o UnmarshalOptions) Unmarshal(b []byte, m Message) error {
|
||||||
|
if o.RecursionLimit == 0 {
|
||||||
|
o.RecursionLimit = protowire.DefaultRecursionLimit
|
||||||
|
}
|
||||||
_, err := o.unmarshal(b, m.ProtoReflect())
|
_, err := o.unmarshal(b, m.ProtoReflect())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -61,8 +71,11 @@ func (o UnmarshalOptions) Unmarshal(b []byte, m Message) error {
|
||||||
// UnmarshalState parses a wire-format message and places the result in m.
|
// UnmarshalState parses a wire-format message and places the result in m.
|
||||||
//
|
//
|
||||||
// This method permits fine-grained control over the unmarshaler.
|
// This method permits fine-grained control over the unmarshaler.
|
||||||
// Most users should use Unmarshal instead.
|
// Most users should use [Unmarshal] instead.
|
||||||
func (o UnmarshalOptions) UnmarshalState(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
func (o UnmarshalOptions) UnmarshalState(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||||
|
if o.RecursionLimit == 0 {
|
||||||
|
o.RecursionLimit = protowire.DefaultRecursionLimit
|
||||||
|
}
|
||||||
return o.unmarshal(in.Buf, in.Message)
|
return o.unmarshal(in.Buf, in.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -86,12 +99,17 @@ func (o UnmarshalOptions) unmarshal(b []byte, m protoreflect.Message) (out proto
|
||||||
Message: m,
|
Message: m,
|
||||||
Buf: b,
|
Buf: b,
|
||||||
Resolver: o.Resolver,
|
Resolver: o.Resolver,
|
||||||
|
Depth: o.RecursionLimit,
|
||||||
}
|
}
|
||||||
if o.DiscardUnknown {
|
if o.DiscardUnknown {
|
||||||
in.Flags |= protoiface.UnmarshalDiscardUnknown
|
in.Flags |= protoiface.UnmarshalDiscardUnknown
|
||||||
}
|
}
|
||||||
out, err = methods.Unmarshal(in)
|
out, err = methods.Unmarshal(in)
|
||||||
} else {
|
} else {
|
||||||
|
o.RecursionLimit--
|
||||||
|
if o.RecursionLimit < 0 {
|
||||||
|
return out, errors.New("exceeded max recursion depth")
|
||||||
|
}
|
||||||
err = o.unmarshalMessageSlow(b, m)
|
err = o.unmarshalMessageSlow(b, m)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
82
vendor/google.golang.org/protobuf/proto/doc.go
generated
vendored
82
vendor/google.golang.org/protobuf/proto/doc.go
generated
vendored
|
|
@ -5,89 +5,81 @@
|
||||||
// Package proto provides functions operating on protocol buffer messages.
|
// Package proto provides functions operating on protocol buffer messages.
|
||||||
//
|
//
|
||||||
// For documentation on protocol buffers in general, see:
|
// For documentation on protocol buffers in general, see:
|
||||||
//
|
// https://protobuf.dev.
|
||||||
// https://developers.google.com/protocol-buffers
|
|
||||||
//
|
//
|
||||||
// For a tutorial on using protocol buffers with Go, see:
|
// For a tutorial on using protocol buffers with Go, see:
|
||||||
//
|
// https://protobuf.dev/getting-started/gotutorial.
|
||||||
// https://developers.google.com/protocol-buffers/docs/gotutorial
|
|
||||||
//
|
//
|
||||||
// For a guide to generated Go protocol buffer code, see:
|
// For a guide to generated Go protocol buffer code, see:
|
||||||
|
// https://protobuf.dev/reference/go/go-generated.
|
||||||
//
|
//
|
||||||
// https://developers.google.com/protocol-buffers/docs/reference/go-generated
|
// # Binary serialization
|
||||||
//
|
|
||||||
//
|
|
||||||
// Binary serialization
|
|
||||||
//
|
//
|
||||||
// This package contains functions to convert to and from the wire format,
|
// This package contains functions to convert to and from the wire format,
|
||||||
// an efficient binary serialization of protocol buffers.
|
// an efficient binary serialization of protocol buffers.
|
||||||
//
|
//
|
||||||
// • Size reports the size of a message in the wire format.
|
// - [Size] reports the size of a message in the wire format.
|
||||||
//
|
//
|
||||||
// • Marshal converts a message to the wire format.
|
// - [Marshal] converts a message to the wire format.
|
||||||
// The MarshalOptions type provides more control over wire marshaling.
|
// The [MarshalOptions] type provides more control over wire marshaling.
|
||||||
//
|
//
|
||||||
// • Unmarshal converts a message from the wire format.
|
// - [Unmarshal] converts a message from the wire format.
|
||||||
// The UnmarshalOptions type provides more control over wire unmarshaling.
|
// The [UnmarshalOptions] type provides more control over wire unmarshaling.
|
||||||
//
|
//
|
||||||
|
// # Basic message operations
|
||||||
//
|
//
|
||||||
// Basic message operations
|
// - [Clone] makes a deep copy of a message.
|
||||||
//
|
//
|
||||||
// • Clone makes a deep copy of a message.
|
// - [Merge] merges the content of a message into another.
|
||||||
//
|
//
|
||||||
// • Merge merges the content of a message into another.
|
// - [Equal] compares two messages. For more control over comparisons
|
||||||
|
// and detailed reporting of differences, see package
|
||||||
|
// [google.golang.org/protobuf/testing/protocmp].
|
||||||
//
|
//
|
||||||
// • Equal compares two messages. For more control over comparisons
|
// - [Reset] clears the content of a message.
|
||||||
// and detailed reporting of differences, see package
|
|
||||||
// "google.golang.org/protobuf/testing/protocmp".
|
|
||||||
//
|
//
|
||||||
// • Reset clears the content of a message.
|
// - [CheckInitialized] reports whether all required fields in a message are set.
|
||||||
//
|
//
|
||||||
// • CheckInitialized reports whether all required fields in a message are set.
|
// # Optional scalar constructors
|
||||||
//
|
|
||||||
//
|
|
||||||
// Optional scalar constructors
|
|
||||||
//
|
//
|
||||||
// The API for some generated messages represents optional scalar fields
|
// The API for some generated messages represents optional scalar fields
|
||||||
// as pointers to a value. For example, an optional string field has the
|
// as pointers to a value. For example, an optional string field has the
|
||||||
// Go type *string.
|
// Go type *string.
|
||||||
//
|
//
|
||||||
// • Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, and String
|
// - [Bool], [Int32], [Int64], [Uint32], [Uint64], [Float32], [Float64], and [String]
|
||||||
// take a value and return a pointer to a new instance of it,
|
// take a value and return a pointer to a new instance of it,
|
||||||
// to simplify construction of optional field values.
|
// to simplify construction of optional field values.
|
||||||
//
|
//
|
||||||
// Generated enum types usually have an Enum method which performs the
|
// Generated enum types usually have an Enum method which performs the
|
||||||
// same operation.
|
// same operation.
|
||||||
//
|
//
|
||||||
// Optional scalar fields are only supported in proto2.
|
// Optional scalar fields are only supported in proto2.
|
||||||
//
|
//
|
||||||
|
// # Extension accessors
|
||||||
//
|
//
|
||||||
// Extension accessors
|
// - [HasExtension], [GetExtension], [SetExtension], and [ClearExtension]
|
||||||
//
|
// access extension field values in a protocol buffer message.
|
||||||
// • HasExtension, GetExtension, SetExtension, and ClearExtension
|
|
||||||
// access extension field values in a protocol buffer message.
|
|
||||||
//
|
//
|
||||||
// Extension fields are only supported in proto2.
|
// Extension fields are only supported in proto2.
|
||||||
//
|
//
|
||||||
|
// # Related packages
|
||||||
//
|
//
|
||||||
// Related packages
|
// - Package [google.golang.org/protobuf/encoding/protojson] converts messages to
|
||||||
|
// and from JSON.
|
||||||
//
|
//
|
||||||
// • Package "google.golang.org/protobuf/encoding/protojson" converts messages to
|
// - Package [google.golang.org/protobuf/encoding/prototext] converts messages to
|
||||||
// and from JSON.
|
// and from the text format.
|
||||||
//
|
//
|
||||||
// • Package "google.golang.org/protobuf/encoding/prototext" converts messages to
|
// - Package [google.golang.org/protobuf/reflect/protoreflect] provides a
|
||||||
// and from the text format.
|
// reflection interface for protocol buffer data types.
|
||||||
//
|
//
|
||||||
// • Package "google.golang.org/protobuf/reflect/protoreflect" provides a
|
// - Package [google.golang.org/protobuf/testing/protocmp] provides features
|
||||||
// reflection interface for protocol buffer data types.
|
// to compare protocol buffer messages with the [github.com/google/go-cmp/cmp]
|
||||||
|
// package.
|
||||||
//
|
//
|
||||||
// • Package "google.golang.org/protobuf/testing/protocmp" provides features
|
// - Package [google.golang.org/protobuf/types/dynamicpb] provides a dynamic
|
||||||
// to compare protocol buffer messages with the "github.com/google/go-cmp/cmp"
|
// message type, suitable for working with messages where the protocol buffer
|
||||||
// package.
|
// type is only known at runtime.
|
||||||
//
|
|
||||||
// • Package "google.golang.org/protobuf/types/dynamicpb" provides a dynamic
|
|
||||||
// message type, suitable for working with messages where the protocol buffer
|
|
||||||
// type is only known at runtime.
|
|
||||||
//
|
//
|
||||||
// This module contains additional packages for more specialized use cases.
|
// This module contains additional packages for more specialized use cases.
|
||||||
// Consult the individual package documentation for details.
|
// Consult the individual package documentation for details.
|
||||||
|
|
|
||||||
51
vendor/google.golang.org/protobuf/proto/encode.go
generated
vendored
51
vendor/google.golang.org/protobuf/proto/encode.go
generated
vendored
|
|
@ -5,18 +5,24 @@
|
||||||
package proto
|
package proto
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/encoding/messageset"
|
"google.golang.org/protobuf/internal/encoding/messageset"
|
||||||
"google.golang.org/protobuf/internal/order"
|
"google.golang.org/protobuf/internal/order"
|
||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
"google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
|
|
||||||
|
protoerrors "google.golang.org/protobuf/internal/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MarshalOptions configures the marshaler.
|
// MarshalOptions configures the marshaler.
|
||||||
//
|
//
|
||||||
// Example usage:
|
// Example usage:
|
||||||
// b, err := MarshalOptions{Deterministic: true}.Marshal(m)
|
//
|
||||||
|
// b, err := MarshalOptions{Deterministic: true}.Marshal(m)
|
||||||
type MarshalOptions struct {
|
type MarshalOptions struct {
|
||||||
pragma.NoUnkeyedLiterals
|
pragma.NoUnkeyedLiterals
|
||||||
|
|
||||||
|
|
@ -69,7 +75,32 @@ type MarshalOptions struct {
|
||||||
UseCachedSize bool
|
UseCachedSize bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// flags turns the specified MarshalOptions (user-facing) into
|
||||||
|
// protoiface.MarshalInputFlags (used internally by the marshaler).
|
||||||
|
//
|
||||||
|
// See impl.marshalOptions.Options for the inverse operation.
|
||||||
|
func (o MarshalOptions) flags() protoiface.MarshalInputFlags {
|
||||||
|
var flags protoiface.MarshalInputFlags
|
||||||
|
|
||||||
|
// Note: o.AllowPartial is always forced to true by MarshalOptions.marshal,
|
||||||
|
// which is why it is not a part of MarshalInputFlags.
|
||||||
|
|
||||||
|
if o.Deterministic {
|
||||||
|
flags |= protoiface.MarshalDeterministic
|
||||||
|
}
|
||||||
|
|
||||||
|
if o.UseCachedSize {
|
||||||
|
flags |= protoiface.MarshalUseCachedSize
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags
|
||||||
|
}
|
||||||
|
|
||||||
// Marshal returns the wire-format encoding of m.
|
// Marshal returns the wire-format encoding of m.
|
||||||
|
//
|
||||||
|
// This is the most common entry point for encoding a Protobuf message.
|
||||||
|
//
|
||||||
|
// See the [MarshalOptions] type if you need more control.
|
||||||
func Marshal(m Message) ([]byte, error) {
|
func Marshal(m Message) ([]byte, error) {
|
||||||
// Treat nil message interface as an empty message; nothing to output.
|
// Treat nil message interface as an empty message; nothing to output.
|
||||||
if m == nil {
|
if m == nil {
|
||||||
|
|
@ -101,7 +132,9 @@ func (o MarshalOptions) Marshal(m Message) ([]byte, error) {
|
||||||
// otherwise it returns a non-nil empty buffer.
|
// otherwise it returns a non-nil empty buffer.
|
||||||
//
|
//
|
||||||
// This is to assist the edge-case where user-code does the following:
|
// This is to assist the edge-case where user-code does the following:
|
||||||
|
//
|
||||||
// m1.OptionalBytes, _ = proto.Marshal(m2)
|
// m1.OptionalBytes, _ = proto.Marshal(m2)
|
||||||
|
//
|
||||||
// where they expect the proto2 "optional_bytes" field to be populated
|
// where they expect the proto2 "optional_bytes" field to be populated
|
||||||
// if any only if m2 is a valid message.
|
// if any only if m2 is a valid message.
|
||||||
func emptyBytesForMessage(m Message) []byte {
|
func emptyBytesForMessage(m Message) []byte {
|
||||||
|
|
@ -113,6 +146,9 @@ func emptyBytesForMessage(m Message) []byte {
|
||||||
|
|
||||||
// MarshalAppend appends the wire-format encoding of m to b,
|
// MarshalAppend appends the wire-format encoding of m to b,
|
||||||
// returning the result.
|
// returning the result.
|
||||||
|
//
|
||||||
|
// This is a less common entry point than [Marshal], which is only needed if you
|
||||||
|
// need to supply your own buffers for performance reasons.
|
||||||
func (o MarshalOptions) MarshalAppend(b []byte, m Message) ([]byte, error) {
|
func (o MarshalOptions) MarshalAppend(b []byte, m Message) ([]byte, error) {
|
||||||
// Treat nil message interface as an empty message; nothing to append.
|
// Treat nil message interface as an empty message; nothing to append.
|
||||||
if m == nil {
|
if m == nil {
|
||||||
|
|
@ -126,7 +162,7 @@ func (o MarshalOptions) MarshalAppend(b []byte, m Message) ([]byte, error) {
|
||||||
// MarshalState returns the wire-format encoding of a message.
|
// MarshalState returns the wire-format encoding of a message.
|
||||||
//
|
//
|
||||||
// This method permits fine-grained control over the marshaler.
|
// This method permits fine-grained control over the marshaler.
|
||||||
// Most users should use Marshal instead.
|
// Most users should use [Marshal] instead.
|
||||||
func (o MarshalOptions) MarshalState(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
func (o MarshalOptions) MarshalState(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
||||||
return o.marshal(in.Buf, in.Message)
|
return o.marshal(in.Buf, in.Message)
|
||||||
}
|
}
|
||||||
|
|
@ -142,12 +178,7 @@ func (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoifac
|
||||||
in := protoiface.MarshalInput{
|
in := protoiface.MarshalInput{
|
||||||
Message: m,
|
Message: m,
|
||||||
Buf: b,
|
Buf: b,
|
||||||
}
|
Flags: o.flags(),
|
||||||
if o.Deterministic {
|
|
||||||
in.Flags |= protoiface.MarshalDeterministic
|
|
||||||
}
|
|
||||||
if o.UseCachedSize {
|
|
||||||
in.Flags |= protoiface.MarshalUseCachedSize
|
|
||||||
}
|
}
|
||||||
if methods.Size != nil {
|
if methods.Size != nil {
|
||||||
sout := methods.Size(protoiface.SizeInput{
|
sout := methods.Size(protoiface.SizeInput{
|
||||||
|
|
@ -165,6 +196,10 @@ func (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoifac
|
||||||
out.Buf, err = o.marshalMessageSlow(b, m)
|
out.Buf, err = o.marshalMessageSlow(b, m)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
var mismatch *protoerrors.SizeMismatchError
|
||||||
|
if errors.As(err, &mismatch) {
|
||||||
|
return out, fmt.Errorf("marshaling %s: %v", string(m.Descriptor().FullName()), err)
|
||||||
|
}
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
if allowPartial {
|
if allowPartial {
|
||||||
|
|
|
||||||
178
vendor/google.golang.org/protobuf/proto/equal.go
generated
vendored
178
vendor/google.golang.org/protobuf/proto/equal.go
generated
vendored
|
|
@ -5,163 +5,53 @@
|
||||||
package proto
|
package proto
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"math"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Equal reports whether two messages are equal.
|
// Equal reports whether two messages are equal,
|
||||||
// If two messages marshal to the same bytes under deterministic serialization,
|
// by recursively comparing the fields of the message.
|
||||||
// then Equal is guaranteed to report true.
|
|
||||||
//
|
//
|
||||||
// Two messages are equal if they belong to the same message descriptor,
|
// - Bytes fields are equal if they contain identical bytes.
|
||||||
// have the same set of populated known and extension field values,
|
// Empty bytes (regardless of nil-ness) are considered equal.
|
||||||
// and the same set of unknown fields values. If either of the top-level
|
|
||||||
// messages are invalid, then Equal reports true only if both are invalid.
|
|
||||||
//
|
//
|
||||||
// Scalar values are compared with the equivalent of the == operator in Go,
|
// - Floating-point fields are equal if they contain the same value.
|
||||||
// except bytes values which are compared using bytes.Equal and
|
// Unlike the == operator, a NaN is equal to another NaN.
|
||||||
// floating point values which specially treat NaNs as equal.
|
//
|
||||||
// Message values are compared by recursively calling Equal.
|
// - Other scalar fields are equal if they contain the same value.
|
||||||
// Lists are equal if each element value is also equal.
|
//
|
||||||
// Maps are equal if they have the same set of keys, where the pair of values
|
// - Message fields are equal if they have
|
||||||
// for each key is also equal.
|
// the same set of populated known and extension field values, and
|
||||||
|
// the same set of unknown fields values.
|
||||||
|
//
|
||||||
|
// - Lists are equal if they are the same length and
|
||||||
|
// each corresponding element is equal.
|
||||||
|
//
|
||||||
|
// - Maps are equal if they have the same set of keys and
|
||||||
|
// the corresponding value for each key is equal.
|
||||||
|
//
|
||||||
|
// An invalid message is not equal to a valid message.
|
||||||
|
// An invalid message is only equal to another invalid message of the
|
||||||
|
// same type. An invalid message often corresponds to a nil pointer
|
||||||
|
// of the concrete message type. For example, (*pb.M)(nil) is not equal
|
||||||
|
// to &pb.M{}.
|
||||||
|
// If two valid messages marshal to the same bytes under deterministic
|
||||||
|
// serialization, then Equal is guaranteed to report true.
|
||||||
func Equal(x, y Message) bool {
|
func Equal(x, y Message) bool {
|
||||||
if x == nil || y == nil {
|
if x == nil || y == nil {
|
||||||
return x == nil && y == nil
|
return x == nil && y == nil
|
||||||
}
|
}
|
||||||
|
if reflect.TypeOf(x).Kind() == reflect.Ptr && x == y {
|
||||||
|
// Avoid an expensive comparison if both inputs are identical pointers.
|
||||||
|
return true
|
||||||
|
}
|
||||||
mx := x.ProtoReflect()
|
mx := x.ProtoReflect()
|
||||||
my := y.ProtoReflect()
|
my := y.ProtoReflect()
|
||||||
if mx.IsValid() != my.IsValid() {
|
if mx.IsValid() != my.IsValid() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return equalMessage(mx, my)
|
vx := protoreflect.ValueOfMessage(mx)
|
||||||
}
|
vy := protoreflect.ValueOfMessage(my)
|
||||||
|
return vx.Equal(vy)
|
||||||
// equalMessage compares two messages.
|
|
||||||
func equalMessage(mx, my pref.Message) bool {
|
|
||||||
if mx.Descriptor() != my.Descriptor() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
nx := 0
|
|
||||||
equal := true
|
|
||||||
mx.Range(func(fd pref.FieldDescriptor, vx pref.Value) bool {
|
|
||||||
nx++
|
|
||||||
vy := my.Get(fd)
|
|
||||||
equal = my.Has(fd) && equalField(fd, vx, vy)
|
|
||||||
return equal
|
|
||||||
})
|
|
||||||
if !equal {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
ny := 0
|
|
||||||
my.Range(func(fd pref.FieldDescriptor, vx pref.Value) bool {
|
|
||||||
ny++
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
if nx != ny {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return equalUnknown(mx.GetUnknown(), my.GetUnknown())
|
|
||||||
}
|
|
||||||
|
|
||||||
// equalField compares two fields.
|
|
||||||
func equalField(fd pref.FieldDescriptor, x, y pref.Value) bool {
|
|
||||||
switch {
|
|
||||||
case fd.IsList():
|
|
||||||
return equalList(fd, x.List(), y.List())
|
|
||||||
case fd.IsMap():
|
|
||||||
return equalMap(fd, x.Map(), y.Map())
|
|
||||||
default:
|
|
||||||
return equalValue(fd, x, y)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// equalMap compares two maps.
|
|
||||||
func equalMap(fd pref.FieldDescriptor, x, y pref.Map) bool {
|
|
||||||
if x.Len() != y.Len() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
equal := true
|
|
||||||
x.Range(func(k pref.MapKey, vx pref.Value) bool {
|
|
||||||
vy := y.Get(k)
|
|
||||||
equal = y.Has(k) && equalValue(fd.MapValue(), vx, vy)
|
|
||||||
return equal
|
|
||||||
})
|
|
||||||
return equal
|
|
||||||
}
|
|
||||||
|
|
||||||
// equalList compares two lists.
|
|
||||||
func equalList(fd pref.FieldDescriptor, x, y pref.List) bool {
|
|
||||||
if x.Len() != y.Len() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
for i := x.Len() - 1; i >= 0; i-- {
|
|
||||||
if !equalValue(fd, x.Get(i), y.Get(i)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// equalValue compares two singular values.
|
|
||||||
func equalValue(fd pref.FieldDescriptor, x, y pref.Value) bool {
|
|
||||||
switch fd.Kind() {
|
|
||||||
case pref.BoolKind:
|
|
||||||
return x.Bool() == y.Bool()
|
|
||||||
case pref.EnumKind:
|
|
||||||
return x.Enum() == y.Enum()
|
|
||||||
case pref.Int32Kind, pref.Sint32Kind,
|
|
||||||
pref.Int64Kind, pref.Sint64Kind,
|
|
||||||
pref.Sfixed32Kind, pref.Sfixed64Kind:
|
|
||||||
return x.Int() == y.Int()
|
|
||||||
case pref.Uint32Kind, pref.Uint64Kind,
|
|
||||||
pref.Fixed32Kind, pref.Fixed64Kind:
|
|
||||||
return x.Uint() == y.Uint()
|
|
||||||
case pref.FloatKind, pref.DoubleKind:
|
|
||||||
fx := x.Float()
|
|
||||||
fy := y.Float()
|
|
||||||
if math.IsNaN(fx) || math.IsNaN(fy) {
|
|
||||||
return math.IsNaN(fx) && math.IsNaN(fy)
|
|
||||||
}
|
|
||||||
return fx == fy
|
|
||||||
case pref.StringKind:
|
|
||||||
return x.String() == y.String()
|
|
||||||
case pref.BytesKind:
|
|
||||||
return bytes.Equal(x.Bytes(), y.Bytes())
|
|
||||||
case pref.MessageKind, pref.GroupKind:
|
|
||||||
return equalMessage(x.Message(), y.Message())
|
|
||||||
default:
|
|
||||||
return x.Interface() == y.Interface()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// equalUnknown compares unknown fields by direct comparison on the raw bytes
|
|
||||||
// of each individual field number.
|
|
||||||
func equalUnknown(x, y pref.RawFields) bool {
|
|
||||||
if len(x) != len(y) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if bytes.Equal([]byte(x), []byte(y)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
mx := make(map[pref.FieldNumber]pref.RawFields)
|
|
||||||
my := make(map[pref.FieldNumber]pref.RawFields)
|
|
||||||
for len(x) > 0 {
|
|
||||||
fnum, _, n := protowire.ConsumeField(x)
|
|
||||||
mx[fnum] = append(mx[fnum], x[:n]...)
|
|
||||||
x = x[n:]
|
|
||||||
}
|
|
||||||
for len(y) > 0 {
|
|
||||||
fnum, _, n := protowire.ConsumeField(y)
|
|
||||||
my[fnum] = append(my[fnum], y[:n]...)
|
|
||||||
y = y[n:]
|
|
||||||
}
|
|
||||||
return reflect.DeepEqual(mx, my)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
vendor/google.golang.org/protobuf/proto/extension.go
generated
vendored
13
vendor/google.golang.org/protobuf/proto/extension.go
generated
vendored
|
|
@ -11,22 +11,25 @@ import (
|
||||||
// HasExtension reports whether an extension field is populated.
|
// HasExtension reports whether an extension field is populated.
|
||||||
// It returns false if m is invalid or if xt does not extend m.
|
// It returns false if m is invalid or if xt does not extend m.
|
||||||
func HasExtension(m Message, xt protoreflect.ExtensionType) bool {
|
func HasExtension(m Message, xt protoreflect.ExtensionType) bool {
|
||||||
// Treat nil message interface as an empty message; no populated fields.
|
// Treat nil message interface or descriptor as an empty message; no populated
|
||||||
if m == nil {
|
// fields.
|
||||||
|
if m == nil || xt == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// As a special-case, we reports invalid or mismatching descriptors
|
// As a special-case, we reports invalid or mismatching descriptors
|
||||||
// as always not being populated (since they aren't).
|
// as always not being populated (since they aren't).
|
||||||
if xt == nil || m.ProtoReflect().Descriptor() != xt.TypeDescriptor().ContainingMessage() {
|
mr := m.ProtoReflect()
|
||||||
|
xd := xt.TypeDescriptor()
|
||||||
|
if mr.Descriptor() != xd.ContainingMessage() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return m.ProtoReflect().Has(xt.TypeDescriptor())
|
return mr.Has(xd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearExtension clears an extension field such that subsequent
|
// ClearExtension clears an extension field such that subsequent
|
||||||
// HasExtension calls return false.
|
// [HasExtension] calls return false.
|
||||||
// It panics if m is invalid or if xt does not extend m.
|
// It panics if m is invalid or if xt does not extend m.
|
||||||
func ClearExtension(m Message, xt protoreflect.ExtensionType) {
|
func ClearExtension(m Message, xt protoreflect.ExtensionType) {
|
||||||
m.ProtoReflect().Clear(xt.TypeDescriptor())
|
m.ProtoReflect().Clear(xt.TypeDescriptor())
|
||||||
|
|
|
||||||
2
vendor/google.golang.org/protobuf/proto/merge.go
generated
vendored
2
vendor/google.golang.org/protobuf/proto/merge.go
generated
vendored
|
|
@ -21,7 +21,7 @@ import (
|
||||||
// The unknown fields of src are appended to the unknown fields of dst.
|
// The unknown fields of src are appended to the unknown fields of dst.
|
||||||
//
|
//
|
||||||
// It is semantically equivalent to unmarshaling the encoded form of src
|
// It is semantically equivalent to unmarshaling the encoded form of src
|
||||||
// into dst with the UnmarshalOptions.Merge option specified.
|
// into dst with the [UnmarshalOptions.Merge] option specified.
|
||||||
func Merge(dst, src Message) {
|
func Merge(dst, src Message) {
|
||||||
// TODO: Should nil src be treated as semantically equivalent to a
|
// TODO: Should nil src be treated as semantically equivalent to a
|
||||||
// untyped, read-only, empty message? What about a nil dst?
|
// untyped, read-only, empty message? What about a nil dst?
|
||||||
|
|
|
||||||
7
vendor/google.golang.org/protobuf/proto/messageset.go
generated
vendored
7
vendor/google.golang.org/protobuf/proto/messageset.go
generated
vendored
|
|
@ -47,11 +47,16 @@ func (o MarshalOptions) marshalMessageSet(b []byte, m protoreflect.Message) ([]b
|
||||||
func (o MarshalOptions) marshalMessageSetField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) {
|
func (o MarshalOptions) marshalMessageSetField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) {
|
||||||
b = messageset.AppendFieldStart(b, fd.Number())
|
b = messageset.AppendFieldStart(b, fd.Number())
|
||||||
b = protowire.AppendTag(b, messageset.FieldMessage, protowire.BytesType)
|
b = protowire.AppendTag(b, messageset.FieldMessage, protowire.BytesType)
|
||||||
b = protowire.AppendVarint(b, uint64(o.Size(value.Message().Interface())))
|
calculatedSize := o.Size(value.Message().Interface())
|
||||||
|
b = protowire.AppendVarint(b, uint64(calculatedSize))
|
||||||
|
before := len(b)
|
||||||
b, err := o.marshalMessage(b, value.Message())
|
b, err := o.marshalMessage(b, value.Message())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return b, err
|
return b, err
|
||||||
}
|
}
|
||||||
|
if measuredSize := len(b) - before; calculatedSize != measuredSize {
|
||||||
|
return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize)
|
||||||
|
}
|
||||||
b = messageset.AppendFieldEnd(b)
|
b = messageset.AppendFieldEnd(b)
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
vendor/google.golang.org/protobuf/proto/proto.go
generated
vendored
18
vendor/google.golang.org/protobuf/proto/proto.go
generated
vendored
|
|
@ -15,18 +15,20 @@ import (
|
||||||
// protobuf module that accept a Message, except where otherwise specified.
|
// protobuf module that accept a Message, except where otherwise specified.
|
||||||
//
|
//
|
||||||
// This is the v2 interface definition for protobuf messages.
|
// This is the v2 interface definition for protobuf messages.
|
||||||
// The v1 interface definition is "github.com/golang/protobuf/proto".Message.
|
// The v1 interface definition is [github.com/golang/protobuf/proto.Message].
|
||||||
//
|
//
|
||||||
// To convert a v1 message to a v2 message,
|
// - To convert a v1 message to a v2 message,
|
||||||
// use "github.com/golang/protobuf/proto".MessageV2.
|
// use [google.golang.org/protobuf/protoadapt.MessageV2Of].
|
||||||
// To convert a v2 message to a v1 message,
|
// - To convert a v2 message to a v1 message,
|
||||||
// use "github.com/golang/protobuf/proto".MessageV1.
|
// use [google.golang.org/protobuf/protoadapt.MessageV1Of].
|
||||||
type Message = protoreflect.ProtoMessage
|
type Message = protoreflect.ProtoMessage
|
||||||
|
|
||||||
// Error matches all errors produced by packages in the protobuf module.
|
// Error matches all errors produced by packages in the protobuf module
|
||||||
|
// according to [errors.Is].
|
||||||
//
|
//
|
||||||
// That is, errors.Is(err, Error) reports whether an error is produced
|
// Example usage:
|
||||||
// by this module.
|
//
|
||||||
|
// if errors.Is(err, proto.Error) { ... }
|
||||||
var Error error
|
var Error error
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
||||||
1
vendor/google.golang.org/protobuf/proto/proto_methods.go
generated
vendored
1
vendor/google.golang.org/protobuf/proto/proto_methods.go
generated
vendored
|
|
@ -3,6 +3,7 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// The protoreflect build tag disables use of fast-path methods.
|
// The protoreflect build tag disables use of fast-path methods.
|
||||||
|
//go:build !protoreflect
|
||||||
// +build !protoreflect
|
// +build !protoreflect
|
||||||
|
|
||||||
package proto
|
package proto
|
||||||
|
|
|
||||||
1
vendor/google.golang.org/protobuf/proto/proto_reflect.go
generated
vendored
1
vendor/google.golang.org/protobuf/proto/proto_reflect.go
generated
vendored
|
|
@ -3,6 +3,7 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// The protoreflect build tag disables use of fast-path methods.
|
// The protoreflect build tag disables use of fast-path methods.
|
||||||
|
//go:build protoreflect
|
||||||
// +build protoreflect
|
// +build protoreflect
|
||||||
|
|
||||||
package proto
|
package proto
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue