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,81 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2016 Uber Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
20
|
-
|
|
21
|
-
package zapcore
|
|
22
|
-
|
|
23
|
-
import "go.uber.org/multierr"
|
|
24
|
-
|
|
25
|
-
type multiCore []Core
|
|
26
|
-
|
|
27
|
-
// NewTee creates a Core that duplicates log entries into two or more
|
|
28
|
-
// underlying Cores.
|
|
29
|
-
//
|
|
30
|
-
// Calling it with a single Core returns the input unchanged, and calling
|
|
31
|
-
// it with no input returns a no-op Core.
|
|
32
|
-
func NewTee(cores ...Core) Core {
|
|
33
|
-
switch len(cores) {
|
|
34
|
-
case 0:
|
|
35
|
-
return NewNopCore()
|
|
36
|
-
case 1:
|
|
37
|
-
return cores[0]
|
|
38
|
-
default:
|
|
39
|
-
return multiCore(cores)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
func (mc multiCore) With(fields []Field) Core {
|
|
44
|
-
clone := make(multiCore, len(mc))
|
|
45
|
-
for i := range mc {
|
|
46
|
-
clone[i] = mc[i].With(fields)
|
|
47
|
-
}
|
|
48
|
-
return clone
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
func (mc multiCore) Enabled(lvl Level) bool {
|
|
52
|
-
for i := range mc {
|
|
53
|
-
if mc[i].Enabled(lvl) {
|
|
54
|
-
return true
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return false
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
func (mc multiCore) Check(ent Entry, ce *CheckedEntry) *CheckedEntry {
|
|
61
|
-
for i := range mc {
|
|
62
|
-
ce = mc[i].Check(ent, ce)
|
|
63
|
-
}
|
|
64
|
-
return ce
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
func (mc multiCore) Write(ent Entry, fields []Field) error {
|
|
68
|
-
var err error
|
|
69
|
-
for i := range mc {
|
|
70
|
-
err = multierr.Append(err, mc[i].Write(ent, fields))
|
|
71
|
-
}
|
|
72
|
-
return err
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
func (mc multiCore) Sync() error {
|
|
76
|
-
var err error
|
|
77
|
-
for i := range mc {
|
|
78
|
-
err = multierr.Append(err, mc[i].Sync())
|
|
79
|
-
}
|
|
80
|
-
return err
|
|
81
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2016 Uber Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
20
|
-
|
|
21
|
-
package zapcore
|
|
22
|
-
|
|
23
|
-
import (
|
|
24
|
-
"io"
|
|
25
|
-
"sync"
|
|
26
|
-
|
|
27
|
-
"go.uber.org/multierr"
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
// A WriteSyncer is an io.Writer that can also flush any buffered data. Note
|
|
31
|
-
// that *os.File (and thus, os.Stderr and os.Stdout) implement WriteSyncer.
|
|
32
|
-
type WriteSyncer interface {
|
|
33
|
-
io.Writer
|
|
34
|
-
Sync() error
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// AddSync converts an io.Writer to a WriteSyncer. It attempts to be
|
|
38
|
-
// intelligent: if the concrete type of the io.Writer implements WriteSyncer,
|
|
39
|
-
// we'll use the existing Sync method. If it doesn't, we'll add a no-op Sync.
|
|
40
|
-
func AddSync(w io.Writer) WriteSyncer {
|
|
41
|
-
switch w := w.(type) {
|
|
42
|
-
case WriteSyncer:
|
|
43
|
-
return w
|
|
44
|
-
default:
|
|
45
|
-
return writerWrapper{w}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
type lockedWriteSyncer struct {
|
|
50
|
-
sync.Mutex
|
|
51
|
-
ws WriteSyncer
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Lock wraps a WriteSyncer in a mutex to make it safe for concurrent use. In
|
|
55
|
-
// particular, *os.Files must be locked before use.
|
|
56
|
-
func Lock(ws WriteSyncer) WriteSyncer {
|
|
57
|
-
if _, ok := ws.(*lockedWriteSyncer); ok {
|
|
58
|
-
// no need to layer on another lock
|
|
59
|
-
return ws
|
|
60
|
-
}
|
|
61
|
-
return &lockedWriteSyncer{ws: ws}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
func (s *lockedWriteSyncer) Write(bs []byte) (int, error) {
|
|
65
|
-
s.Lock()
|
|
66
|
-
n, err := s.ws.Write(bs)
|
|
67
|
-
s.Unlock()
|
|
68
|
-
return n, err
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
func (s *lockedWriteSyncer) Sync() error {
|
|
72
|
-
s.Lock()
|
|
73
|
-
err := s.ws.Sync()
|
|
74
|
-
s.Unlock()
|
|
75
|
-
return err
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
type writerWrapper struct {
|
|
79
|
-
io.Writer
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
func (w writerWrapper) Sync() error {
|
|
83
|
-
return nil
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
type multiWriteSyncer []WriteSyncer
|
|
87
|
-
|
|
88
|
-
// NewMultiWriteSyncer creates a WriteSyncer that duplicates its writes
|
|
89
|
-
// and sync calls, much like io.MultiWriter.
|
|
90
|
-
func NewMultiWriteSyncer(ws ...WriteSyncer) WriteSyncer {
|
|
91
|
-
if len(ws) == 1 {
|
|
92
|
-
return ws[0]
|
|
93
|
-
}
|
|
94
|
-
// Copy to protect against https://github.com/golang/go/issues/7809
|
|
95
|
-
return multiWriteSyncer(append([]WriteSyncer(nil), ws...))
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// See https://golang.org/src/io/multi.go
|
|
99
|
-
// When not all underlying syncers write the same number of bytes,
|
|
100
|
-
// the smallest number is returned even though Write() is called on
|
|
101
|
-
// all of them.
|
|
102
|
-
func (ws multiWriteSyncer) Write(p []byte) (int, error) {
|
|
103
|
-
var writeErr error
|
|
104
|
-
nWritten := 0
|
|
105
|
-
for _, w := range ws {
|
|
106
|
-
n, err := w.Write(p)
|
|
107
|
-
writeErr = multierr.Append(writeErr, err)
|
|
108
|
-
if nWritten == 0 && n != 0 {
|
|
109
|
-
nWritten = n
|
|
110
|
-
} else if n < nWritten {
|
|
111
|
-
nWritten = n
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return nWritten, writeErr
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
func (ws multiWriteSyncer) Sync() error {
|
|
118
|
-
var err error
|
|
119
|
-
for _, w := range ws {
|
|
120
|
-
err = multierr.Append(err, w.Sync())
|
|
121
|
-
}
|
|
122
|
-
return err
|
|
123
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2009 The Go Authors. All rights reserved.
|
|
2
|
-
|
|
3
|
-
Redistribution and use in source and binary forms, with or without
|
|
4
|
-
modification, are permitted provided that the following conditions are
|
|
5
|
-
met:
|
|
6
|
-
|
|
7
|
-
* Redistributions of source code must retain the above copyright
|
|
8
|
-
notice, this list of conditions and the following disclaimer.
|
|
9
|
-
* Redistributions in binary form must reproduce the above
|
|
10
|
-
copyright notice, this list of conditions and the following disclaimer
|
|
11
|
-
in the documentation and/or other materials provided with the
|
|
12
|
-
distribution.
|
|
13
|
-
* Neither the name of Google Inc. nor the names of its
|
|
14
|
-
contributors may be used to endorse or promote products derived from
|
|
15
|
-
this software without specific prior written permission.
|
|
16
|
-
|
|
17
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
18
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
19
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
20
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
21
|
-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
22
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
23
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
24
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
25
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Additional IP Rights Grant (Patents)
|
|
2
|
-
|
|
3
|
-
"This implementation" means the copyrightable works distributed by
|
|
4
|
-
Google as part of the Go project.
|
|
5
|
-
|
|
6
|
-
Google hereby grants to You a perpetual, worldwide, non-exclusive,
|
|
7
|
-
no-charge, royalty-free, irrevocable (except as stated in this section)
|
|
8
|
-
patent license to make, have made, use, offer to sell, sell, import,
|
|
9
|
-
transfer and otherwise run, modify and propagate the contents of this
|
|
10
|
-
implementation of Go, where such license applies only to those patent
|
|
11
|
-
claims, both currently owned or controlled by Google and acquired in
|
|
12
|
-
the future, licensable by Google that are necessarily infringed by this
|
|
13
|
-
implementation of Go. This grant does not include claims that would be
|
|
14
|
-
infringed only as a consequence of further modification of this
|
|
15
|
-
implementation. If you or your agent or exclusive licensee institute or
|
|
16
|
-
order or agree to the institution of patent litigation against any
|
|
17
|
-
entity (including a cross-claim or counterclaim in a lawsuit) alleging
|
|
18
|
-
that this implementation of Go or any code incorporated within this
|
|
19
|
-
implementation of Go constitutes direct or contributory patent
|
|
20
|
-
infringement, or inducement of patent infringement, then any patent
|
|
21
|
-
rights granted to you under this License for this implementation of Go
|
|
22
|
-
shall terminate as of the date such litigation is filed.
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// Copyright 2014 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 context defines the Context type, which carries deadlines,
|
|
6
|
-
// cancelation signals, and other request-scoped values across API boundaries
|
|
7
|
-
// and between processes.
|
|
8
|
-
// As of Go 1.7 this package is available in the standard library under the
|
|
9
|
-
// name context. https://golang.org/pkg/context.
|
|
10
|
-
//
|
|
11
|
-
// Incoming requests to a server should create a Context, and outgoing calls to
|
|
12
|
-
// servers should accept a Context. The chain of function calls between must
|
|
13
|
-
// propagate the Context, optionally replacing it with a modified copy created
|
|
14
|
-
// using WithDeadline, WithTimeout, WithCancel, or WithValue.
|
|
15
|
-
//
|
|
16
|
-
// Programs that use Contexts should follow these rules to keep interfaces
|
|
17
|
-
// consistent across packages and enable static analysis tools to check context
|
|
18
|
-
// propagation:
|
|
19
|
-
//
|
|
20
|
-
// Do not store Contexts inside a struct type; instead, pass a Context
|
|
21
|
-
// explicitly to each function that needs it. The Context should be the first
|
|
22
|
-
// parameter, typically named ctx:
|
|
23
|
-
//
|
|
24
|
-
// func DoSomething(ctx context.Context, arg Arg) error {
|
|
25
|
-
// // ... use ctx ...
|
|
26
|
-
// }
|
|
27
|
-
//
|
|
28
|
-
// Do not pass a nil Context, even if a function permits it. Pass context.TODO
|
|
29
|
-
// if you are unsure about which Context to use.
|
|
30
|
-
//
|
|
31
|
-
// Use context Values only for request-scoped data that transits processes and
|
|
32
|
-
// APIs, not for passing optional parameters to functions.
|
|
33
|
-
//
|
|
34
|
-
// The same Context may be passed to functions running in different goroutines;
|
|
35
|
-
// Contexts are safe for simultaneous use by multiple goroutines.
|
|
36
|
-
//
|
|
37
|
-
// See http://blog.golang.org/context for example code for a server that uses
|
|
38
|
-
// Contexts.
|
|
39
|
-
package context // import "golang.org/x/net/context"
|
|
40
|
-
|
|
41
|
-
// Background returns a non-nil, empty Context. It is never canceled, has no
|
|
42
|
-
// values, and has no deadline. It is typically used by the main function,
|
|
43
|
-
// initialization, and tests, and as the top-level Context for incoming
|
|
44
|
-
// requests.
|
|
45
|
-
func Background() Context {
|
|
46
|
-
return background
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// TODO returns a non-nil, empty Context. Code should use context.TODO when
|
|
50
|
-
// it's unclear which Context to use or it is not yet available (because the
|
|
51
|
-
// surrounding function has not yet been extended to accept a Context
|
|
52
|
-
// parameter). TODO is recognized by static analysis tools that determine
|
|
53
|
-
// whether Contexts are propagated correctly in a program.
|
|
54
|
-
func TODO() Context {
|
|
55
|
-
return todo
|
|
56
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// Copyright 2016 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 ctxhttp provides helper functions for performing context-aware HTTP requests.
|
|
6
|
-
package ctxhttp // import "golang.org/x/net/context/ctxhttp"
|
|
7
|
-
|
|
8
|
-
import (
|
|
9
|
-
"context"
|
|
10
|
-
"io"
|
|
11
|
-
"net/http"
|
|
12
|
-
"net/url"
|
|
13
|
-
"strings"
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
// Do sends an HTTP request with the provided http.Client and returns
|
|
17
|
-
// an HTTP response.
|
|
18
|
-
//
|
|
19
|
-
// If the client is nil, http.DefaultClient is used.
|
|
20
|
-
//
|
|
21
|
-
// The provided ctx must be non-nil. If it is canceled or times out,
|
|
22
|
-
// ctx.Err() will be returned.
|
|
23
|
-
func Do(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) {
|
|
24
|
-
if client == nil {
|
|
25
|
-
client = http.DefaultClient
|
|
26
|
-
}
|
|
27
|
-
resp, err := client.Do(req.WithContext(ctx))
|
|
28
|
-
// If we got an error, and the context has been canceled,
|
|
29
|
-
// the context's error is probably more useful.
|
|
30
|
-
if err != nil {
|
|
31
|
-
select {
|
|
32
|
-
case <-ctx.Done():
|
|
33
|
-
err = ctx.Err()
|
|
34
|
-
default:
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return resp, err
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Get issues a GET request via the Do function.
|
|
41
|
-
func Get(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
|
|
42
|
-
req, err := http.NewRequest("GET", url, nil)
|
|
43
|
-
if err != nil {
|
|
44
|
-
return nil, err
|
|
45
|
-
}
|
|
46
|
-
return Do(ctx, client, req)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Head issues a HEAD request via the Do function.
|
|
50
|
-
func Head(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
|
|
51
|
-
req, err := http.NewRequest("HEAD", url, nil)
|
|
52
|
-
if err != nil {
|
|
53
|
-
return nil, err
|
|
54
|
-
}
|
|
55
|
-
return Do(ctx, client, req)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Post issues a POST request via the Do function.
|
|
59
|
-
func Post(ctx context.Context, client *http.Client, url string, bodyType string, body io.Reader) (*http.Response, error) {
|
|
60
|
-
req, err := http.NewRequest("POST", url, body)
|
|
61
|
-
if err != nil {
|
|
62
|
-
return nil, err
|
|
63
|
-
}
|
|
64
|
-
req.Header.Set("Content-Type", bodyType)
|
|
65
|
-
return Do(ctx, client, req)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// PostForm issues a POST request via the Do function.
|
|
69
|
-
func PostForm(ctx context.Context, client *http.Client, url string, data url.Values) (*http.Response, error) {
|
|
70
|
-
return Post(ctx, client, url, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
|
|
71
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Copyright 2016 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
|
-
//go:build go1.7
|
|
6
|
-
// +build go1.7
|
|
7
|
-
|
|
8
|
-
package context
|
|
9
|
-
|
|
10
|
-
import (
|
|
11
|
-
"context" // standard library's context, as of Go 1.7
|
|
12
|
-
"time"
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
var (
|
|
16
|
-
todo = context.TODO()
|
|
17
|
-
background = context.Background()
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
// Canceled is the error returned by Context.Err when the context is canceled.
|
|
21
|
-
var Canceled = context.Canceled
|
|
22
|
-
|
|
23
|
-
// DeadlineExceeded is the error returned by Context.Err when the context's
|
|
24
|
-
// deadline passes.
|
|
25
|
-
var DeadlineExceeded = context.DeadlineExceeded
|
|
26
|
-
|
|
27
|
-
// WithCancel returns a copy of parent with a new Done channel. The returned
|
|
28
|
-
// context's Done channel is closed when the returned cancel function is called
|
|
29
|
-
// or when the parent context's Done channel is closed, whichever happens first.
|
|
30
|
-
//
|
|
31
|
-
// Canceling this context releases resources associated with it, so code should
|
|
32
|
-
// call cancel as soon as the operations running in this Context complete.
|
|
33
|
-
func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
|
|
34
|
-
ctx, f := context.WithCancel(parent)
|
|
35
|
-
return ctx, CancelFunc(f)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// WithDeadline returns a copy of the parent context with the deadline adjusted
|
|
39
|
-
// to be no later than d. If the parent's deadline is already earlier than d,
|
|
40
|
-
// WithDeadline(parent, d) is semantically equivalent to parent. The returned
|
|
41
|
-
// context's Done channel is closed when the deadline expires, when the returned
|
|
42
|
-
// cancel function is called, or when the parent context's Done channel is
|
|
43
|
-
// closed, whichever happens first.
|
|
44
|
-
//
|
|
45
|
-
// Canceling this context releases resources associated with it, so code should
|
|
46
|
-
// call cancel as soon as the operations running in this Context complete.
|
|
47
|
-
func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) {
|
|
48
|
-
ctx, f := context.WithDeadline(parent, deadline)
|
|
49
|
-
return ctx, CancelFunc(f)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)).
|
|
53
|
-
//
|
|
54
|
-
// Canceling this context releases resources associated with it, so code should
|
|
55
|
-
// call cancel as soon as the operations running in this Context complete:
|
|
56
|
-
//
|
|
57
|
-
// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
|
|
58
|
-
// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
|
|
59
|
-
// defer cancel() // releases resources if slowOperation completes before timeout elapses
|
|
60
|
-
// return slowOperation(ctx)
|
|
61
|
-
// }
|
|
62
|
-
func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) {
|
|
63
|
-
return WithDeadline(parent, time.Now().Add(timeout))
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// WithValue returns a copy of parent in which the value associated with key is
|
|
67
|
-
// val.
|
|
68
|
-
//
|
|
69
|
-
// Use context Values only for request-scoped data that transits processes and
|
|
70
|
-
// APIs, not for passing optional parameters to functions.
|
|
71
|
-
func WithValue(parent Context, key interface{}, val interface{}) Context {
|
|
72
|
-
return context.WithValue(parent, key, val)
|
|
73
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Copyright 2017 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
|
-
//go:build go1.9
|
|
6
|
-
// +build go1.9
|
|
7
|
-
|
|
8
|
-
package context
|
|
9
|
-
|
|
10
|
-
import "context" // standard library's context, as of Go 1.7
|
|
11
|
-
|
|
12
|
-
// A Context carries a deadline, a cancelation signal, and other values across
|
|
13
|
-
// API boundaries.
|
|
14
|
-
//
|
|
15
|
-
// Context's methods may be called by multiple goroutines simultaneously.
|
|
16
|
-
type Context = context.Context
|
|
17
|
-
|
|
18
|
-
// A CancelFunc tells an operation to abandon its work.
|
|
19
|
-
// A CancelFunc does not wait for the work to stop.
|
|
20
|
-
// After the first call, subsequent calls to a CancelFunc do nothing.
|
|
21
|
-
type CancelFunc = context.CancelFunc
|