planetscale 0.2.0 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.buildkite/pipeline.yml +21 -0
- data/.github/workflows/ci.yml +9 -1
- data/.github/workflows/gem-push.yml +9 -2
- data/.licenses/go/github.com/matoous/go-nanoid/v2.dep.yml +34 -0
- data/.licenses/go/github.com/planetscale/planetscale-go/planetscale.dep.yml +56 -3
- data/.licenses/go/github.com/planetscale/sql-proxy/proxy.dep.yml +205 -172
- data/.licenses/go/go.uber.org/zap/buffer.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap/internal/bufferpool.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap/internal/color.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap/internal/exit.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap/zapcore.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap.dep.yml +1 -1
- data/README.md +11 -8
- data/controller.go +24 -26
- data/go.mod +4 -3
- data/go.sum +42 -27
- data/lib/generators/planetscale/install_generator.rb +8 -6
- data/lib/planetscale/version.rb +1 -1
- data/lib/planetscale.rb +14 -15
- data/planetscale.gemspec +2 -2
- data/proxy/planetscale-darwin.h +1 -1
- data/proxy/planetscale-darwin.so +0 -0
- data/proxy/planetscale-linux.h +1 -1
- data/proxy/planetscale-linux.so +0 -0
- data/proxy.go +1 -5
- metadata +6 -342
- data/vendor/github.com/armon/circbuf/.gitignore +0 -22
- data/vendor/github.com/armon/circbuf/LICENSE +0 -20
- data/vendor/github.com/armon/circbuf/README.md +0 -28
- data/vendor/github.com/armon/circbuf/circbuf.go +0 -92
- data/vendor/github.com/armon/circbuf/go.mod +0 -1
- data/vendor/github.com/golang/protobuf/AUTHORS +0 -3
- data/vendor/github.com/golang/protobuf/CONTRIBUTORS +0 -3
- data/vendor/github.com/golang/protobuf/LICENSE +0 -28
- data/vendor/github.com/golang/protobuf/proto/buffer.go +0 -324
- data/vendor/github.com/golang/protobuf/proto/defaults.go +0 -63
- data/vendor/github.com/golang/protobuf/proto/deprecated.go +0 -113
- data/vendor/github.com/golang/protobuf/proto/discard.go +0 -58
- data/vendor/github.com/golang/protobuf/proto/extensions.go +0 -356
- data/vendor/github.com/golang/protobuf/proto/properties.go +0 -306
- data/vendor/github.com/golang/protobuf/proto/proto.go +0 -167
- data/vendor/github.com/golang/protobuf/proto/registry.go +0 -317
- data/vendor/github.com/golang/protobuf/proto/text_decode.go +0 -801
- data/vendor/github.com/golang/protobuf/proto/text_encode.go +0 -560
- data/vendor/github.com/golang/protobuf/proto/wire.go +0 -78
- data/vendor/github.com/golang/protobuf/proto/wrappers.go +0 -34
- data/vendor/github.com/gorilla/mux/AUTHORS +0 -8
- data/vendor/github.com/gorilla/mux/LICENSE +0 -27
- data/vendor/github.com/gorilla/mux/README.md +0 -805
- data/vendor/github.com/gorilla/mux/doc.go +0 -306
- data/vendor/github.com/gorilla/mux/go.mod +0 -3
- data/vendor/github.com/gorilla/mux/middleware.go +0 -74
- data/vendor/github.com/gorilla/mux/mux.go +0 -606
- data/vendor/github.com/gorilla/mux/regexp.go +0 -388
- data/vendor/github.com/gorilla/mux/route.go +0 -736
- data/vendor/github.com/gorilla/mux/test_helpers.go +0 -19
- data/vendor/github.com/hashicorp/go-cleanhttp/LICENSE +0 -363
- data/vendor/github.com/hashicorp/go-cleanhttp/README.md +0 -30
- data/vendor/github.com/hashicorp/go-cleanhttp/cleanhttp.go +0 -58
- data/vendor/github.com/hashicorp/go-cleanhttp/doc.go +0 -20
- data/vendor/github.com/hashicorp/go-cleanhttp/go.mod +0 -3
- data/vendor/github.com/hashicorp/go-cleanhttp/handlers.go +0 -48
- data/vendor/github.com/mitchellh/go-homedir/LICENSE +0 -21
- data/vendor/github.com/mitchellh/go-homedir/README.md +0 -14
- data/vendor/github.com/mitchellh/go-homedir/go.mod +0 -1
- data/vendor/github.com/mitchellh/go-homedir/homedir.go +0 -167
- data/vendor/github.com/pkg/errors/.gitignore +0 -24
- data/vendor/github.com/pkg/errors/.travis.yml +0 -10
- data/vendor/github.com/pkg/errors/LICENSE +0 -23
- data/vendor/github.com/pkg/errors/Makefile +0 -44
- data/vendor/github.com/pkg/errors/README.md +0 -59
- data/vendor/github.com/pkg/errors/appveyor.yml +0 -32
- data/vendor/github.com/pkg/errors/errors.go +0 -288
- data/vendor/github.com/pkg/errors/go113.go +0 -38
- data/vendor/github.com/pkg/errors/stack.go +0 -177
- data/vendor/github.com/planetscale/planetscale-go/planetscale/backups.go +0 -139
- data/vendor/github.com/planetscale/planetscale-go/planetscale/branches.go +0 -258
- data/vendor/github.com/planetscale/planetscale-go/planetscale/certs.go +0 -142
- data/vendor/github.com/planetscale/planetscale-go/planetscale/client.go +0 -305
- data/vendor/github.com/planetscale/planetscale-go/planetscale/databases.go +0 -131
- data/vendor/github.com/planetscale/planetscale-go/planetscale/deploy_requests.go +0 -368
- data/vendor/github.com/planetscale/planetscale-go/planetscale/organizations.go +0 -78
- data/vendor/github.com/planetscale/planetscale-go/planetscale/service_tokens.go +0 -163
- data/vendor/github.com/planetscale/sql-proxy/proxy/client.go +0 -467
- data/vendor/github.com/planetscale/sql-proxy/proxy/tls_cache.go +0 -73
- data/vendor/go.uber.org/atomic/.codecov.yml +0 -19
- data/vendor/go.uber.org/atomic/.gitignore +0 -12
- data/vendor/go.uber.org/atomic/.travis.yml +0 -27
- data/vendor/go.uber.org/atomic/CHANGELOG.md +0 -76
- data/vendor/go.uber.org/atomic/LICENSE.txt +0 -19
- data/vendor/go.uber.org/atomic/Makefile +0 -78
- data/vendor/go.uber.org/atomic/README.md +0 -63
- data/vendor/go.uber.org/atomic/bool.go +0 -81
- data/vendor/go.uber.org/atomic/bool_ext.go +0 -53
- data/vendor/go.uber.org/atomic/doc.go +0 -23
- data/vendor/go.uber.org/atomic/duration.go +0 -82
- data/vendor/go.uber.org/atomic/duration_ext.go +0 -40
- data/vendor/go.uber.org/atomic/error.go +0 -51
- data/vendor/go.uber.org/atomic/error_ext.go +0 -39
- data/vendor/go.uber.org/atomic/float64.go +0 -76
- data/vendor/go.uber.org/atomic/float64_ext.go +0 -47
- data/vendor/go.uber.org/atomic/gen.go +0 -26
- data/vendor/go.uber.org/atomic/go.mod +0 -8
- data/vendor/go.uber.org/atomic/go.sum +0 -9
- data/vendor/go.uber.org/atomic/int32.go +0 -102
- data/vendor/go.uber.org/atomic/int64.go +0 -102
- data/vendor/go.uber.org/atomic/nocmp.go +0 -35
- data/vendor/go.uber.org/atomic/string.go +0 -54
- data/vendor/go.uber.org/atomic/string_ext.go +0 -43
- data/vendor/go.uber.org/atomic/uint32.go +0 -102
- data/vendor/go.uber.org/atomic/uint64.go +0 -102
- data/vendor/go.uber.org/atomic/value.go +0 -31
- data/vendor/go.uber.org/multierr/.codecov.yml +0 -15
- data/vendor/go.uber.org/multierr/.gitignore +0 -4
- data/vendor/go.uber.org/multierr/.travis.yml +0 -23
- data/vendor/go.uber.org/multierr/CHANGELOG.md +0 -60
- data/vendor/go.uber.org/multierr/LICENSE.txt +0 -19
- data/vendor/go.uber.org/multierr/Makefile +0 -42
- data/vendor/go.uber.org/multierr/README.md +0 -23
- data/vendor/go.uber.org/multierr/error.go +0 -449
- data/vendor/go.uber.org/multierr/glide.yaml +0 -8
- data/vendor/go.uber.org/multierr/go.mod +0 -8
- data/vendor/go.uber.org/multierr/go.sum +0 -11
- data/vendor/go.uber.org/multierr/go113.go +0 -52
- data/vendor/go.uber.org/zap/.codecov.yml +0 -17
- data/vendor/go.uber.org/zap/.gitignore +0 -32
- data/vendor/go.uber.org/zap/.readme.tmpl +0 -109
- data/vendor/go.uber.org/zap/.travis.yml +0 -23
- data/vendor/go.uber.org/zap/CHANGELOG.md +0 -432
- data/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md +0 -75
- data/vendor/go.uber.org/zap/CONTRIBUTING.md +0 -81
- data/vendor/go.uber.org/zap/FAQ.md +0 -156
- data/vendor/go.uber.org/zap/LICENSE.txt +0 -19
- data/vendor/go.uber.org/zap/Makefile +0 -63
- data/vendor/go.uber.org/zap/README.md +0 -134
- data/vendor/go.uber.org/zap/array.go +0 -320
- data/vendor/go.uber.org/zap/buffer/buffer.go +0 -123
- data/vendor/go.uber.org/zap/buffer/pool.go +0 -49
- data/vendor/go.uber.org/zap/checklicense.sh +0 -17
- data/vendor/go.uber.org/zap/config.go +0 -264
- data/vendor/go.uber.org/zap/doc.go +0 -113
- data/vendor/go.uber.org/zap/encoder.go +0 -79
- data/vendor/go.uber.org/zap/error.go +0 -80
- data/vendor/go.uber.org/zap/field.go +0 -539
- data/vendor/go.uber.org/zap/flag.go +0 -39
- data/vendor/go.uber.org/zap/glide.yaml +0 -34
- data/vendor/go.uber.org/zap/global.go +0 -168
- data/vendor/go.uber.org/zap/global_go112.go +0 -26
- data/vendor/go.uber.org/zap/global_prego112.go +0 -26
- data/vendor/go.uber.org/zap/go.mod +0 -13
- data/vendor/go.uber.org/zap/go.sum +0 -56
- data/vendor/go.uber.org/zap/http_handler.go +0 -81
- data/vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go +0 -31
- data/vendor/go.uber.org/zap/internal/color/color.go +0 -44
- data/vendor/go.uber.org/zap/internal/exit/exit.go +0 -64
- data/vendor/go.uber.org/zap/level.go +0 -132
- data/vendor/go.uber.org/zap/logger.go +0 -344
- data/vendor/go.uber.org/zap/options.go +0 -140
- data/vendor/go.uber.org/zap/sink.go +0 -161
- data/vendor/go.uber.org/zap/stacktrace.go +0 -85
- data/vendor/go.uber.org/zap/sugar.go +0 -304
- data/vendor/go.uber.org/zap/time.go +0 -27
- data/vendor/go.uber.org/zap/writer.go +0 -99
- data/vendor/go.uber.org/zap/zapcore/console_encoder.go +0 -161
- data/vendor/go.uber.org/zap/zapcore/core.go +0 -113
- data/vendor/go.uber.org/zap/zapcore/doc.go +0 -24
- data/vendor/go.uber.org/zap/zapcore/encoder.go +0 -443
- data/vendor/go.uber.org/zap/zapcore/entry.go +0 -264
- data/vendor/go.uber.org/zap/zapcore/error.go +0 -115
- data/vendor/go.uber.org/zap/zapcore/field.go +0 -227
- data/vendor/go.uber.org/zap/zapcore/hook.go +0 -68
- data/vendor/go.uber.org/zap/zapcore/increase_level.go +0 -66
- data/vendor/go.uber.org/zap/zapcore/json_encoder.go +0 -534
- data/vendor/go.uber.org/zap/zapcore/level.go +0 -175
- data/vendor/go.uber.org/zap/zapcore/level_strings.go +0 -46
- data/vendor/go.uber.org/zap/zapcore/marshaler.go +0 -61
- data/vendor/go.uber.org/zap/zapcore/memory_encoder.go +0 -179
- data/vendor/go.uber.org/zap/zapcore/sampler.go +0 -208
- data/vendor/go.uber.org/zap/zapcore/tee.go +0 -81
- data/vendor/go.uber.org/zap/zapcore/write_syncer.go +0 -123
- data/vendor/golang.org/x/net/AUTHORS +0 -3
- data/vendor/golang.org/x/net/CONTRIBUTORS +0 -3
- data/vendor/golang.org/x/net/LICENSE +0 -27
- data/vendor/golang.org/x/net/PATENTS +0 -22
- data/vendor/golang.org/x/net/context/context.go +0 -56
- data/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go +0 -71
- data/vendor/golang.org/x/net/context/go17.go +0 -73
- data/vendor/golang.org/x/net/context/go19.go +0 -21
- data/vendor/golang.org/x/net/context/pre_go17.go +0 -301
- data/vendor/golang.org/x/net/context/pre_go19.go +0 -110
- data/vendor/golang.org/x/oauth2/.travis.yml +0 -13
- data/vendor/golang.org/x/oauth2/AUTHORS +0 -3
- data/vendor/golang.org/x/oauth2/CONTRIBUTING.md +0 -26
- data/vendor/golang.org/x/oauth2/CONTRIBUTORS +0 -3
- data/vendor/golang.org/x/oauth2/LICENSE +0 -27
- data/vendor/golang.org/x/oauth2/README.md +0 -36
- data/vendor/golang.org/x/oauth2/go.mod +0 -9
- data/vendor/golang.org/x/oauth2/go.sum +0 -361
- data/vendor/golang.org/x/oauth2/internal/client_appengine.go +0 -14
- data/vendor/golang.org/x/oauth2/internal/doc.go +0 -6
- data/vendor/golang.org/x/oauth2/internal/oauth2.go +0 -37
- data/vendor/golang.org/x/oauth2/internal/token.go +0 -294
- data/vendor/golang.org/x/oauth2/internal/transport.go +0 -33
- data/vendor/golang.org/x/oauth2/oauth2.go +0 -381
- data/vendor/golang.org/x/oauth2/token.go +0 -178
- data/vendor/golang.org/x/oauth2/transport.go +0 -89
- data/vendor/google.golang.org/appengine/LICENSE +0 -202
- data/vendor/google.golang.org/appengine/internal/api.go +0 -678
- data/vendor/google.golang.org/appengine/internal/api_classic.go +0 -169
- data/vendor/google.golang.org/appengine/internal/api_common.go +0 -123
- data/vendor/google.golang.org/appengine/internal/app_id.go +0 -28
- data/vendor/google.golang.org/appengine/internal/base/api_base.pb.go +0 -308
- data/vendor/google.golang.org/appengine/internal/base/api_base.proto +0 -33
- data/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go +0 -4367
- data/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto +0 -551
- data/vendor/google.golang.org/appengine/internal/identity.go +0 -55
- data/vendor/google.golang.org/appengine/internal/identity_classic.go +0 -61
- data/vendor/google.golang.org/appengine/internal/identity_flex.go +0 -11
- data/vendor/google.golang.org/appengine/internal/identity_vm.go +0 -134
- data/vendor/google.golang.org/appengine/internal/internal.go +0 -110
- data/vendor/google.golang.org/appengine/internal/log/log_service.pb.go +0 -1313
- data/vendor/google.golang.org/appengine/internal/log/log_service.proto +0 -150
- data/vendor/google.golang.org/appengine/internal/main.go +0 -16
- data/vendor/google.golang.org/appengine/internal/main_common.go +0 -7
- data/vendor/google.golang.org/appengine/internal/main_vm.go +0 -69
- data/vendor/google.golang.org/appengine/internal/metadata.go +0 -60
- data/vendor/google.golang.org/appengine/internal/net.go +0 -56
- data/vendor/google.golang.org/appengine/internal/regen.sh +0 -40
- data/vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go +0 -361
- data/vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto +0 -44
- data/vendor/google.golang.org/appengine/internal/transaction.go +0 -115
- data/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go +0 -527
- data/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto +0 -64
- data/vendor/google.golang.org/appengine/urlfetch/urlfetch.go +0 -210
- data/vendor/google.golang.org/protobuf/AUTHORS +0 -3
- data/vendor/google.golang.org/protobuf/CONTRIBUTORS +0 -3
- data/vendor/google.golang.org/protobuf/LICENSE +0 -27
- data/vendor/google.golang.org/protobuf/PATENTS +0 -22
- data/vendor/google.golang.org/protobuf/encoding/prototext/decode.go +0 -773
- data/vendor/google.golang.org/protobuf/encoding/prototext/doc.go +0 -7
- data/vendor/google.golang.org/protobuf/encoding/prototext/encode.go +0 -371
- data/vendor/google.golang.org/protobuf/encoding/protowire/wire.go +0 -538
- data/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go +0 -318
- data/vendor/google.golang.org/protobuf/internal/descopts/options.go +0 -29
- data/vendor/google.golang.org/protobuf/internal/detrand/rand.go +0 -69
- data/vendor/google.golang.org/protobuf/internal/encoding/defval/default.go +0 -213
- data/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go +0 -241
- data/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go +0 -207
- data/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go +0 -665
- data/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go +0 -190
- data/vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go +0 -161
- data/vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go +0 -373
- data/vendor/google.golang.org/protobuf/internal/encoding/text/doc.go +0 -29
- data/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go +0 -265
- data/vendor/google.golang.org/protobuf/internal/errors/errors.go +0 -89
- data/vendor/google.golang.org/protobuf/internal/errors/is_go112.go +0 -39
- data/vendor/google.golang.org/protobuf/internal/errors/is_go113.go +0 -12
- data/vendor/google.golang.org/protobuf/internal/filedesc/build.go +0 -158
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +0 -631
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +0 -471
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +0 -704
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go +0 -450
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go +0 -356
- data/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go +0 -107
- data/vendor/google.golang.org/protobuf/internal/filetype/build.go +0 -297
- data/vendor/google.golang.org/protobuf/internal/flags/flags.go +0 -24
- data/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go +0 -9
- data/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go +0 -9
- data/vendor/google.golang.org/protobuf/internal/genid/any_gen.go +0 -34
- data/vendor/google.golang.org/protobuf/internal/genid/api_gen.go +0 -106
- data/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +0 -829
- data/vendor/google.golang.org/protobuf/internal/genid/doc.go +0 -11
- data/vendor/google.golang.org/protobuf/internal/genid/duration_gen.go +0 -34
- data/vendor/google.golang.org/protobuf/internal/genid/empty_gen.go +0 -19
- data/vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go +0 -31
- data/vendor/google.golang.org/protobuf/internal/genid/goname.go +0 -25
- data/vendor/google.golang.org/protobuf/internal/genid/map_entry.go +0 -16
- data/vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go +0 -31
- data/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go +0 -116
- data/vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go +0 -34
- data/vendor/google.golang.org/protobuf/internal/genid/type_gen.go +0 -184
- data/vendor/google.golang.org/protobuf/internal/genid/wrappers.go +0 -13
- data/vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go +0 -175
- data/vendor/google.golang.org/protobuf/internal/impl/api_export.go +0 -177
- data/vendor/google.golang.org/protobuf/internal/impl/checkinit.go +0 -141
- data/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go +0 -223
- data/vendor/google.golang.org/protobuf/internal/impl/codec_field.go +0 -830
- data/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go +0 -5637
- data/vendor/google.golang.org/protobuf/internal/impl/codec_map.go +0 -388
- data/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go +0 -37
- data/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go +0 -11
- data/vendor/google.golang.org/protobuf/internal/impl/codec_message.go +0 -217
- data/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go +0 -123
- data/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go +0 -209
- data/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go +0 -557
- data/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go +0 -17
- data/vendor/google.golang.org/protobuf/internal/impl/convert.go +0 -496
- data/vendor/google.golang.org/protobuf/internal/impl/convert_list.go +0 -141
- data/vendor/google.golang.org/protobuf/internal/impl/convert_map.go +0 -121
- data/vendor/google.golang.org/protobuf/internal/impl/decode.go +0 -276
- data/vendor/google.golang.org/protobuf/internal/impl/encode.go +0 -201
- data/vendor/google.golang.org/protobuf/internal/impl/enum.go +0 -21
- data/vendor/google.golang.org/protobuf/internal/impl/extension.go +0 -156
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go +0 -219
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go +0 -92
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go +0 -176
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go +0 -81
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go +0 -558
- data/vendor/google.golang.org/protobuf/internal/impl/merge.go +0 -176
- data/vendor/google.golang.org/protobuf/internal/impl/merge_gen.go +0 -209
- data/vendor/google.golang.org/protobuf/internal/impl/message.go +0 -276
- data/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go +0 -465
- data/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go +0 -543
- data/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go +0 -249
- data/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go +0 -178
- data/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go +0 -174
- data/vendor/google.golang.org/protobuf/internal/impl/validate.go +0 -576
- data/vendor/google.golang.org/protobuf/internal/impl/weak.go +0 -74
- data/vendor/google.golang.org/protobuf/internal/order/order.go +0 -89
- data/vendor/google.golang.org/protobuf/internal/order/range.go +0 -115
- data/vendor/google.golang.org/protobuf/internal/pragma/pragma.go +0 -29
- data/vendor/google.golang.org/protobuf/internal/set/ints.go +0 -58
- data/vendor/google.golang.org/protobuf/internal/strs/strings.go +0 -196
- data/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go +0 -27
- data/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go +0 -94
- data/vendor/google.golang.org/protobuf/internal/version/version.go +0 -79
- data/vendor/google.golang.org/protobuf/proto/checkinit.go +0 -71
- data/vendor/google.golang.org/protobuf/proto/decode.go +0 -278
- data/vendor/google.golang.org/protobuf/proto/decode_gen.go +0 -603
- data/vendor/google.golang.org/protobuf/proto/doc.go +0 -94
- data/vendor/google.golang.org/protobuf/proto/encode.go +0 -319
- data/vendor/google.golang.org/protobuf/proto/encode_gen.go +0 -97
- data/vendor/google.golang.org/protobuf/proto/equal.go +0 -167
- data/vendor/google.golang.org/protobuf/proto/extension.go +0 -92
- data/vendor/google.golang.org/protobuf/proto/merge.go +0 -139
- data/vendor/google.golang.org/protobuf/proto/messageset.go +0 -93
- data/vendor/google.golang.org/protobuf/proto/proto.go +0 -43
- data/vendor/google.golang.org/protobuf/proto/proto_methods.go +0 -19
- data/vendor/google.golang.org/protobuf/proto/proto_reflect.go +0 -19
- data/vendor/google.golang.org/protobuf/proto/reset.go +0 -43
- data/vendor/google.golang.org/protobuf/proto/size.go +0 -97
- data/vendor/google.golang.org/protobuf/proto/size_gen.go +0 -55
- data/vendor/google.golang.org/protobuf/proto/wrappers.go +0 -29
- data/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go +0 -276
- data/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go +0 -248
- data/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go +0 -286
- data/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go +0 -374
- data/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go +0 -252
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go +0 -77
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go +0 -504
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go +0 -128
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +0 -461
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go +0 -665
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go +0 -285
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go +0 -59
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go +0 -411
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go +0 -98
- data/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go +0 -869
- data/vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go +0 -15
- data/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go +0 -167
- data/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go +0 -44
- data/vendor/google.golang.org/protobuf/runtime/protoimpl/version.go +0 -56
- data/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go +0 -4039
- data/vendor/modules.txt +0 -79
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
// Copyright 2019 The Go Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style
|
|
3
|
-
// license that can be found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
package proto
|
|
6
|
-
|
|
7
|
-
import (
|
|
8
|
-
"errors"
|
|
9
|
-
"fmt"
|
|
10
|
-
|
|
11
|
-
"google.golang.org/protobuf/encoding/prototext"
|
|
12
|
-
"google.golang.org/protobuf/encoding/protowire"
|
|
13
|
-
"google.golang.org/protobuf/runtime/protoimpl"
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
const (
|
|
17
|
-
WireVarint = 0
|
|
18
|
-
WireFixed32 = 5
|
|
19
|
-
WireFixed64 = 1
|
|
20
|
-
WireBytes = 2
|
|
21
|
-
WireStartGroup = 3
|
|
22
|
-
WireEndGroup = 4
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
// EncodeVarint returns the varint encoded bytes of v.
|
|
26
|
-
func EncodeVarint(v uint64) []byte {
|
|
27
|
-
return protowire.AppendVarint(nil, v)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// SizeVarint returns the length of the varint encoded bytes of v.
|
|
31
|
-
// This is equal to len(EncodeVarint(v)).
|
|
32
|
-
func SizeVarint(v uint64) int {
|
|
33
|
-
return protowire.SizeVarint(v)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// DecodeVarint parses a varint encoded integer from b,
|
|
37
|
-
// returning the integer value and the length of the varint.
|
|
38
|
-
// It returns (0, 0) if there is a parse error.
|
|
39
|
-
func DecodeVarint(b []byte) (uint64, int) {
|
|
40
|
-
v, n := protowire.ConsumeVarint(b)
|
|
41
|
-
if n < 0 {
|
|
42
|
-
return 0, 0
|
|
43
|
-
}
|
|
44
|
-
return v, n
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Buffer is a buffer for encoding and decoding the protobuf wire format.
|
|
48
|
-
// It may be reused between invocations to reduce memory usage.
|
|
49
|
-
type Buffer struct {
|
|
50
|
-
buf []byte
|
|
51
|
-
idx int
|
|
52
|
-
deterministic bool
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// NewBuffer allocates a new Buffer initialized with buf,
|
|
56
|
-
// where the contents of buf are considered the unread portion of the buffer.
|
|
57
|
-
func NewBuffer(buf []byte) *Buffer {
|
|
58
|
-
return &Buffer{buf: buf}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// SetDeterministic specifies whether to use deterministic serialization.
|
|
62
|
-
//
|
|
63
|
-
// Deterministic serialization guarantees that for a given binary, equal
|
|
64
|
-
// messages will always be serialized to the same bytes. This implies:
|
|
65
|
-
//
|
|
66
|
-
// - Repeated serialization of a message will return the same bytes.
|
|
67
|
-
// - Different processes of the same binary (which may be executing on
|
|
68
|
-
// different machines) will serialize equal messages to the same bytes.
|
|
69
|
-
//
|
|
70
|
-
// Note that the deterministic serialization is NOT canonical across
|
|
71
|
-
// languages. It is not guaranteed to remain stable over time. It is unstable
|
|
72
|
-
// across different builds with schema changes due to unknown fields.
|
|
73
|
-
// Users who need canonical serialization (e.g., persistent storage in a
|
|
74
|
-
// canonical form, fingerprinting, etc.) should define their own
|
|
75
|
-
// canonicalization specification and implement their own serializer rather
|
|
76
|
-
// than relying on this API.
|
|
77
|
-
//
|
|
78
|
-
// If deterministic serialization is requested, map entries will be sorted
|
|
79
|
-
// by keys in lexographical order. This is an implementation detail and
|
|
80
|
-
// subject to change.
|
|
81
|
-
func (b *Buffer) SetDeterministic(deterministic bool) {
|
|
82
|
-
b.deterministic = deterministic
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// SetBuf sets buf as the internal buffer,
|
|
86
|
-
// where the contents of buf are considered the unread portion of the buffer.
|
|
87
|
-
func (b *Buffer) SetBuf(buf []byte) {
|
|
88
|
-
b.buf = buf
|
|
89
|
-
b.idx = 0
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Reset clears the internal buffer of all written and unread data.
|
|
93
|
-
func (b *Buffer) Reset() {
|
|
94
|
-
b.buf = b.buf[:0]
|
|
95
|
-
b.idx = 0
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Bytes returns the internal buffer.
|
|
99
|
-
func (b *Buffer) Bytes() []byte {
|
|
100
|
-
return b.buf
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Unread returns the unread portion of the buffer.
|
|
104
|
-
func (b *Buffer) Unread() []byte {
|
|
105
|
-
return b.buf[b.idx:]
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Marshal appends the wire-format encoding of m to the buffer.
|
|
109
|
-
func (b *Buffer) Marshal(m Message) error {
|
|
110
|
-
var err error
|
|
111
|
-
b.buf, err = marshalAppend(b.buf, m, b.deterministic)
|
|
112
|
-
return err
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Unmarshal parses the wire-format message in the buffer and
|
|
116
|
-
// places the decoded results in m.
|
|
117
|
-
// It does not reset m before unmarshaling.
|
|
118
|
-
func (b *Buffer) Unmarshal(m Message) error {
|
|
119
|
-
err := UnmarshalMerge(b.Unread(), m)
|
|
120
|
-
b.idx = len(b.buf)
|
|
121
|
-
return err
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
type unknownFields struct{ XXX_unrecognized protoimpl.UnknownFields }
|
|
125
|
-
|
|
126
|
-
func (m *unknownFields) String() string { panic("not implemented") }
|
|
127
|
-
func (m *unknownFields) Reset() { panic("not implemented") }
|
|
128
|
-
func (m *unknownFields) ProtoMessage() { panic("not implemented") }
|
|
129
|
-
|
|
130
|
-
// DebugPrint dumps the encoded bytes of b with a header and footer including s
|
|
131
|
-
// to stdout. This is only intended for debugging.
|
|
132
|
-
func (*Buffer) DebugPrint(s string, b []byte) {
|
|
133
|
-
m := MessageReflect(new(unknownFields))
|
|
134
|
-
m.SetUnknown(b)
|
|
135
|
-
b, _ = prototext.MarshalOptions{AllowPartial: true, Indent: "\t"}.Marshal(m.Interface())
|
|
136
|
-
fmt.Printf("==== %s ====\n%s==== %s ====\n", s, b, s)
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// EncodeVarint appends an unsigned varint encoding to the buffer.
|
|
140
|
-
func (b *Buffer) EncodeVarint(v uint64) error {
|
|
141
|
-
b.buf = protowire.AppendVarint(b.buf, v)
|
|
142
|
-
return nil
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// EncodeZigzag32 appends a 32-bit zig-zag varint encoding to the buffer.
|
|
146
|
-
func (b *Buffer) EncodeZigzag32(v uint64) error {
|
|
147
|
-
return b.EncodeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31))))
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// EncodeZigzag64 appends a 64-bit zig-zag varint encoding to the buffer.
|
|
151
|
-
func (b *Buffer) EncodeZigzag64(v uint64) error {
|
|
152
|
-
return b.EncodeVarint(uint64((uint64(v) << 1) ^ uint64((int64(v) >> 63))))
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// EncodeFixed32 appends a 32-bit little-endian integer to the buffer.
|
|
156
|
-
func (b *Buffer) EncodeFixed32(v uint64) error {
|
|
157
|
-
b.buf = protowire.AppendFixed32(b.buf, uint32(v))
|
|
158
|
-
return nil
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// EncodeFixed64 appends a 64-bit little-endian integer to the buffer.
|
|
162
|
-
func (b *Buffer) EncodeFixed64(v uint64) error {
|
|
163
|
-
b.buf = protowire.AppendFixed64(b.buf, uint64(v))
|
|
164
|
-
return nil
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// EncodeRawBytes appends a length-prefixed raw bytes to the buffer.
|
|
168
|
-
func (b *Buffer) EncodeRawBytes(v []byte) error {
|
|
169
|
-
b.buf = protowire.AppendBytes(b.buf, v)
|
|
170
|
-
return nil
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// EncodeStringBytes appends a length-prefixed raw bytes to the buffer.
|
|
174
|
-
// It does not validate whether v contains valid UTF-8.
|
|
175
|
-
func (b *Buffer) EncodeStringBytes(v string) error {
|
|
176
|
-
b.buf = protowire.AppendString(b.buf, v)
|
|
177
|
-
return nil
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// EncodeMessage appends a length-prefixed encoded message to the buffer.
|
|
181
|
-
func (b *Buffer) EncodeMessage(m Message) error {
|
|
182
|
-
var err error
|
|
183
|
-
b.buf = protowire.AppendVarint(b.buf, uint64(Size(m)))
|
|
184
|
-
b.buf, err = marshalAppend(b.buf, m, b.deterministic)
|
|
185
|
-
return err
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// DecodeVarint consumes an encoded unsigned varint from the buffer.
|
|
189
|
-
func (b *Buffer) DecodeVarint() (uint64, error) {
|
|
190
|
-
v, n := protowire.ConsumeVarint(b.buf[b.idx:])
|
|
191
|
-
if n < 0 {
|
|
192
|
-
return 0, protowire.ParseError(n)
|
|
193
|
-
}
|
|
194
|
-
b.idx += n
|
|
195
|
-
return uint64(v), nil
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// DecodeZigzag32 consumes an encoded 32-bit zig-zag varint from the buffer.
|
|
199
|
-
func (b *Buffer) DecodeZigzag32() (uint64, error) {
|
|
200
|
-
v, err := b.DecodeVarint()
|
|
201
|
-
if err != nil {
|
|
202
|
-
return 0, err
|
|
203
|
-
}
|
|
204
|
-
return uint64((uint32(v) >> 1) ^ uint32((int32(v&1)<<31)>>31)), nil
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// DecodeZigzag64 consumes an encoded 64-bit zig-zag varint from the buffer.
|
|
208
|
-
func (b *Buffer) DecodeZigzag64() (uint64, error) {
|
|
209
|
-
v, err := b.DecodeVarint()
|
|
210
|
-
if err != nil {
|
|
211
|
-
return 0, err
|
|
212
|
-
}
|
|
213
|
-
return uint64((uint64(v) >> 1) ^ uint64((int64(v&1)<<63)>>63)), nil
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// DecodeFixed32 consumes a 32-bit little-endian integer from the buffer.
|
|
217
|
-
func (b *Buffer) DecodeFixed32() (uint64, error) {
|
|
218
|
-
v, n := protowire.ConsumeFixed32(b.buf[b.idx:])
|
|
219
|
-
if n < 0 {
|
|
220
|
-
return 0, protowire.ParseError(n)
|
|
221
|
-
}
|
|
222
|
-
b.idx += n
|
|
223
|
-
return uint64(v), nil
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// DecodeFixed64 consumes a 64-bit little-endian integer from the buffer.
|
|
227
|
-
func (b *Buffer) DecodeFixed64() (uint64, error) {
|
|
228
|
-
v, n := protowire.ConsumeFixed64(b.buf[b.idx:])
|
|
229
|
-
if n < 0 {
|
|
230
|
-
return 0, protowire.ParseError(n)
|
|
231
|
-
}
|
|
232
|
-
b.idx += n
|
|
233
|
-
return uint64(v), nil
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// DecodeRawBytes consumes a length-prefixed raw bytes from the buffer.
|
|
237
|
-
// If alloc is specified, it returns a copy the raw bytes
|
|
238
|
-
// rather than a sub-slice of the buffer.
|
|
239
|
-
func (b *Buffer) DecodeRawBytes(alloc bool) ([]byte, error) {
|
|
240
|
-
v, n := protowire.ConsumeBytes(b.buf[b.idx:])
|
|
241
|
-
if n < 0 {
|
|
242
|
-
return nil, protowire.ParseError(n)
|
|
243
|
-
}
|
|
244
|
-
b.idx += n
|
|
245
|
-
if alloc {
|
|
246
|
-
v = append([]byte(nil), v...)
|
|
247
|
-
}
|
|
248
|
-
return v, nil
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// DecodeStringBytes consumes a length-prefixed raw bytes from the buffer.
|
|
252
|
-
// It does not validate whether the raw bytes contain valid UTF-8.
|
|
253
|
-
func (b *Buffer) DecodeStringBytes() (string, error) {
|
|
254
|
-
v, n := protowire.ConsumeString(b.buf[b.idx:])
|
|
255
|
-
if n < 0 {
|
|
256
|
-
return "", protowire.ParseError(n)
|
|
257
|
-
}
|
|
258
|
-
b.idx += n
|
|
259
|
-
return v, nil
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// DecodeMessage consumes a length-prefixed message from the buffer.
|
|
263
|
-
// It does not reset m before unmarshaling.
|
|
264
|
-
func (b *Buffer) DecodeMessage(m Message) error {
|
|
265
|
-
v, err := b.DecodeRawBytes(false)
|
|
266
|
-
if err != nil {
|
|
267
|
-
return err
|
|
268
|
-
}
|
|
269
|
-
return UnmarshalMerge(v, m)
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// DecodeGroup consumes a message group from the buffer.
|
|
273
|
-
// It assumes that the start group marker has already been consumed and
|
|
274
|
-
// consumes all bytes until (and including the end group marker).
|
|
275
|
-
// It does not reset m before unmarshaling.
|
|
276
|
-
func (b *Buffer) DecodeGroup(m Message) error {
|
|
277
|
-
v, n, err := consumeGroup(b.buf[b.idx:])
|
|
278
|
-
if err != nil {
|
|
279
|
-
return err
|
|
280
|
-
}
|
|
281
|
-
b.idx += n
|
|
282
|
-
return UnmarshalMerge(v, m)
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// consumeGroup parses b until it finds an end group marker, returning
|
|
286
|
-
// the raw bytes of the message (excluding the end group marker) and the
|
|
287
|
-
// the total length of the message (including the end group marker).
|
|
288
|
-
func consumeGroup(b []byte) ([]byte, int, error) {
|
|
289
|
-
b0 := b
|
|
290
|
-
depth := 1 // assume this follows a start group marker
|
|
291
|
-
for {
|
|
292
|
-
_, wtyp, tagLen := protowire.ConsumeTag(b)
|
|
293
|
-
if tagLen < 0 {
|
|
294
|
-
return nil, 0, protowire.ParseError(tagLen)
|
|
295
|
-
}
|
|
296
|
-
b = b[tagLen:]
|
|
297
|
-
|
|
298
|
-
var valLen int
|
|
299
|
-
switch wtyp {
|
|
300
|
-
case protowire.VarintType:
|
|
301
|
-
_, valLen = protowire.ConsumeVarint(b)
|
|
302
|
-
case protowire.Fixed32Type:
|
|
303
|
-
_, valLen = protowire.ConsumeFixed32(b)
|
|
304
|
-
case protowire.Fixed64Type:
|
|
305
|
-
_, valLen = protowire.ConsumeFixed64(b)
|
|
306
|
-
case protowire.BytesType:
|
|
307
|
-
_, valLen = protowire.ConsumeBytes(b)
|
|
308
|
-
case protowire.StartGroupType:
|
|
309
|
-
depth++
|
|
310
|
-
case protowire.EndGroupType:
|
|
311
|
-
depth--
|
|
312
|
-
default:
|
|
313
|
-
return nil, 0, errors.New("proto: cannot parse reserved wire type")
|
|
314
|
-
}
|
|
315
|
-
if valLen < 0 {
|
|
316
|
-
return nil, 0, protowire.ParseError(valLen)
|
|
317
|
-
}
|
|
318
|
-
b = b[valLen:]
|
|
319
|
-
|
|
320
|
-
if depth == 0 {
|
|
321
|
-
return b0[:len(b0)-len(b)-tagLen], len(b0) - len(b), nil
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// Copyright 2019 The Go Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style
|
|
3
|
-
// license that can be found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
package proto
|
|
6
|
-
|
|
7
|
-
import (
|
|
8
|
-
"google.golang.org/protobuf/reflect/protoreflect"
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
// SetDefaults sets unpopulated scalar fields to their default values.
|
|
12
|
-
// Fields within a oneof are not set even if they have a default value.
|
|
13
|
-
// SetDefaults is recursively called upon any populated message fields.
|
|
14
|
-
func SetDefaults(m Message) {
|
|
15
|
-
if m != nil {
|
|
16
|
-
setDefaults(MessageReflect(m))
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
func setDefaults(m protoreflect.Message) {
|
|
21
|
-
fds := m.Descriptor().Fields()
|
|
22
|
-
for i := 0; i < fds.Len(); i++ {
|
|
23
|
-
fd := fds.Get(i)
|
|
24
|
-
if !m.Has(fd) {
|
|
25
|
-
if fd.HasDefault() && fd.ContainingOneof() == nil {
|
|
26
|
-
v := fd.Default()
|
|
27
|
-
if fd.Kind() == protoreflect.BytesKind {
|
|
28
|
-
v = protoreflect.ValueOf(append([]byte(nil), v.Bytes()...)) // copy the default bytes
|
|
29
|
-
}
|
|
30
|
-
m.Set(fd, v)
|
|
31
|
-
}
|
|
32
|
-
continue
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
|
|
37
|
-
switch {
|
|
38
|
-
// Handle singular message.
|
|
39
|
-
case fd.Cardinality() != protoreflect.Repeated:
|
|
40
|
-
if fd.Message() != nil {
|
|
41
|
-
setDefaults(m.Get(fd).Message())
|
|
42
|
-
}
|
|
43
|
-
// Handle list of messages.
|
|
44
|
-
case fd.IsList():
|
|
45
|
-
if fd.Message() != nil {
|
|
46
|
-
ls := m.Get(fd).List()
|
|
47
|
-
for i := 0; i < ls.Len(); i++ {
|
|
48
|
-
setDefaults(ls.Get(i).Message())
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// Handle map of messages.
|
|
52
|
-
case fd.IsMap():
|
|
53
|
-
if fd.MapValue().Message() != nil {
|
|
54
|
-
ms := m.Get(fd).Map()
|
|
55
|
-
ms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool {
|
|
56
|
-
setDefaults(v.Message())
|
|
57
|
-
return true
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return true
|
|
62
|
-
})
|
|
63
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
// Copyright 2018 The Go Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style
|
|
3
|
-
// license that can be found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
package proto
|
|
6
|
-
|
|
7
|
-
import (
|
|
8
|
-
"encoding/json"
|
|
9
|
-
"errors"
|
|
10
|
-
"fmt"
|
|
11
|
-
"strconv"
|
|
12
|
-
|
|
13
|
-
protoV2 "google.golang.org/protobuf/proto"
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
var (
|
|
17
|
-
// Deprecated: No longer returned.
|
|
18
|
-
ErrNil = errors.New("proto: Marshal called with nil")
|
|
19
|
-
|
|
20
|
-
// Deprecated: No longer returned.
|
|
21
|
-
ErrTooLarge = errors.New("proto: message encodes to over 2 GB")
|
|
22
|
-
|
|
23
|
-
// Deprecated: No longer returned.
|
|
24
|
-
ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof")
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
// Deprecated: Do not use.
|
|
28
|
-
type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 }
|
|
29
|
-
|
|
30
|
-
// Deprecated: Do not use.
|
|
31
|
-
func GetStats() Stats { return Stats{} }
|
|
32
|
-
|
|
33
|
-
// Deprecated: Do not use.
|
|
34
|
-
func MarshalMessageSet(interface{}) ([]byte, error) {
|
|
35
|
-
return nil, errors.New("proto: not implemented")
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Deprecated: Do not use.
|
|
39
|
-
func UnmarshalMessageSet([]byte, interface{}) error {
|
|
40
|
-
return errors.New("proto: not implemented")
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Deprecated: Do not use.
|
|
44
|
-
func MarshalMessageSetJSON(interface{}) ([]byte, error) {
|
|
45
|
-
return nil, errors.New("proto: not implemented")
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Deprecated: Do not use.
|
|
49
|
-
func UnmarshalMessageSetJSON([]byte, interface{}) error {
|
|
50
|
-
return errors.New("proto: not implemented")
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Deprecated: Do not use.
|
|
54
|
-
func RegisterMessageSetType(Message, int32, string) {}
|
|
55
|
-
|
|
56
|
-
// Deprecated: Do not use.
|
|
57
|
-
func EnumName(m map[int32]string, v int32) string {
|
|
58
|
-
s, ok := m[v]
|
|
59
|
-
if ok {
|
|
60
|
-
return s
|
|
61
|
-
}
|
|
62
|
-
return strconv.Itoa(int(v))
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Deprecated: Do not use.
|
|
66
|
-
func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) {
|
|
67
|
-
if data[0] == '"' {
|
|
68
|
-
// New style: enums are strings.
|
|
69
|
-
var repr string
|
|
70
|
-
if err := json.Unmarshal(data, &repr); err != nil {
|
|
71
|
-
return -1, err
|
|
72
|
-
}
|
|
73
|
-
val, ok := m[repr]
|
|
74
|
-
if !ok {
|
|
75
|
-
return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr)
|
|
76
|
-
}
|
|
77
|
-
return val, nil
|
|
78
|
-
}
|
|
79
|
-
// Old style: enums are ints.
|
|
80
|
-
var val int32
|
|
81
|
-
if err := json.Unmarshal(data, &val); err != nil {
|
|
82
|
-
return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName)
|
|
83
|
-
}
|
|
84
|
-
return val, nil
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Deprecated: Do not use; this type existed for intenal-use only.
|
|
88
|
-
type InternalMessageInfo struct{}
|
|
89
|
-
|
|
90
|
-
// Deprecated: Do not use; this method existed for intenal-use only.
|
|
91
|
-
func (*InternalMessageInfo) DiscardUnknown(m Message) {
|
|
92
|
-
DiscardUnknown(m)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Deprecated: Do not use; this method existed for intenal-use only.
|
|
96
|
-
func (*InternalMessageInfo) Marshal(b []byte, m Message, deterministic bool) ([]byte, error) {
|
|
97
|
-
return protoV2.MarshalOptions{Deterministic: deterministic}.MarshalAppend(b, MessageV2(m))
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Deprecated: Do not use; this method existed for intenal-use only.
|
|
101
|
-
func (*InternalMessageInfo) Merge(dst, src Message) {
|
|
102
|
-
protoV2.Merge(MessageV2(dst), MessageV2(src))
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Deprecated: Do not use; this method existed for intenal-use only.
|
|
106
|
-
func (*InternalMessageInfo) Size(m Message) int {
|
|
107
|
-
return protoV2.Size(MessageV2(m))
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Deprecated: Do not use; this method existed for intenal-use only.
|
|
111
|
-
func (*InternalMessageInfo) Unmarshal(m Message, b []byte) error {
|
|
112
|
-
return protoV2.UnmarshalOptions{Merge: true}.Unmarshal(b, MessageV2(m))
|
|
113
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// Copyright 2019 The Go Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style
|
|
3
|
-
// license that can be found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
package proto
|
|
6
|
-
|
|
7
|
-
import (
|
|
8
|
-
"google.golang.org/protobuf/reflect/protoreflect"
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
// DiscardUnknown recursively discards all unknown fields from this message
|
|
12
|
-
// and all embedded messages.
|
|
13
|
-
//
|
|
14
|
-
// When unmarshaling a message with unrecognized fields, the tags and values
|
|
15
|
-
// of such fields are preserved in the Message. This allows a later call to
|
|
16
|
-
// marshal to be able to produce a message that continues to have those
|
|
17
|
-
// unrecognized fields. To avoid this, DiscardUnknown is used to
|
|
18
|
-
// explicitly clear the unknown fields after unmarshaling.
|
|
19
|
-
func DiscardUnknown(m Message) {
|
|
20
|
-
if m != nil {
|
|
21
|
-
discardUnknown(MessageReflect(m))
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
func discardUnknown(m protoreflect.Message) {
|
|
26
|
-
m.Range(func(fd protoreflect.FieldDescriptor, val protoreflect.Value) bool {
|
|
27
|
-
switch {
|
|
28
|
-
// Handle singular message.
|
|
29
|
-
case fd.Cardinality() != protoreflect.Repeated:
|
|
30
|
-
if fd.Message() != nil {
|
|
31
|
-
discardUnknown(m.Get(fd).Message())
|
|
32
|
-
}
|
|
33
|
-
// Handle list of messages.
|
|
34
|
-
case fd.IsList():
|
|
35
|
-
if fd.Message() != nil {
|
|
36
|
-
ls := m.Get(fd).List()
|
|
37
|
-
for i := 0; i < ls.Len(); i++ {
|
|
38
|
-
discardUnknown(ls.Get(i).Message())
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
// Handle map of messages.
|
|
42
|
-
case fd.IsMap():
|
|
43
|
-
if fd.MapValue().Message() != nil {
|
|
44
|
-
ms := m.Get(fd).Map()
|
|
45
|
-
ms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool {
|
|
46
|
-
discardUnknown(v.Message())
|
|
47
|
-
return true
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return true
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
// Discard unknown fields.
|
|
55
|
-
if len(m.GetUnknown()) > 0 {
|
|
56
|
-
m.SetUnknown(nil)
|
|
57
|
-
}
|
|
58
|
-
}
|