From ebd8ddf05b652ae5c415d499d25932f8d67c6aac Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Tue, 11 Apr 2023 22:20:37 +0300 Subject: [PATCH] move to v4 Signed-off-by: Vasiliy Tolstov --- README.md | 2 +- broker/broker.go | 6 +- broker/memory.go | 12 ++-- broker/memory_test.go | 2 +- broker/options.go | 10 ++-- client/backoff.go | 2 +- client/client.go | 6 +- client/lookup.go | 4 +- client/noop.go | 10 ++-- client/options.go | 22 +++---- client/retry.go | 2 +- client/retry_test.go | 2 +- client/test_request.go | 2 +- codec/codec.go | 4 +- codec/frame.proto | 4 +- codec/options.go | 6 +- config/config.go | 2 +- config/default.go | 6 +- config/default_test.go | 4 +- config/options.go | 8 +-- errors/errors.go | 2 +- errors/errors.proto | 4 +- event.go | 2 +- flow/default.go | 12 ++-- flow/flow.go | 4 +- flow/options.go | 10 ++-- fsm/fsm.go | 2 +- fsm/fsm_test.go | 2 +- go.mod | 5 +- go.sum | 2 + logger/logger.go | 2 +- logger/unwrap/unwrap.go | 2 +- logger/unwrap/unwrap_test.go | 2 +- logger/wrapper/wrapper.go | 6 +- metadata/metadata.go | 2 +- meter/meter.go | 2 +- meter/options.go | 2 +- meter/wrapper/wrapper.go | 8 +-- mtls/mtls.go | 2 +- network/network.go | 6 +- network/options.go | 14 ++--- network/transport/memory.go | 6 +- network/transport/options.go | 8 +-- network/transport/transport.go | 4 +- network/tunnel/broker/broker.go | 12 ++-- network/tunnel/options.go | 10 ++-- network/tunnel/transport/listener.go | 4 +- network/tunnel/transport/transport.go | 6 +- network/tunnel/tunnel.go | 4 +- options.go | 22 +++---- options/hooks.go | 2 +- profiler/http/http.go | 4 +- profiler/pprof/pprof.go | 4 +- profiler/profile.go | 2 +- proxy/options.go | 10 ++-- proxy/proxy.go | 4 +- register/extractor.go | 2 +- register/memory.go | 4 +- register/options.go | 6 +- register/register.go | 4 +- resolver/dns/dns.go | 4 +- resolver/dnssrv/dnssrv.go | 4 +- resolver/http/http.go | 4 +- resolver/noop/noop.go | 4 +- resolver/registry/registry.go | 6 +- resolver/resolver.go | 2 +- resolver/static/static.go | 4 +- router/options.go | 6 +- router/route.go | 2 +- router/router.go | 2 +- selector/random/random.go | 6 +- selector/random/random_test.go | 2 +- selector/roundrobin/roundrobin.go | 6 +- selector/roundrobin/roundrobin_test.go | 2 +- selector/selector.go | 2 +- server/errors.go | 2 +- server/errors_test.go | 2 +- server/handler.go | 2 +- server/noop.go | 14 ++--- server/noop_test.go | 12 ++-- server/options.go | 20 +++---- server/registry.go | 8 +-- server/request.go | 4 +- server/server.go | 8 +-- server/subscriber.go | 12 ++-- service.go | 22 +++---- service_test.go | 20 +++---- store/memory_test.go | 2 +- store/options.go | 10 ++-- store/store.go | 2 +- sync/options.go | 6 +- sync/sync.go | 2 +- tracer/options.go | 2 +- tracer/tracer.go | 2 +- tracer/wrapper/wrapper.go | 10 ++-- util/addr/addr.go | 2 +- util/backoff/backoff.go | 2 +- util/buf/buf.go | 2 +- util/http/http.go | 6 +- util/http/http_test.go | 8 +-- util/http/options.go | 2 +- util/http/roundtripper.go | 4 +- util/id/id.go | 4 +- util/io/io.go | 4 +- util/jitter/random.go | 4 +- util/jitter/ticker.go | 4 +- util/net/net.go | 2 +- util/pki/pki.go | 2 +- util/pool/default.go | 4 +- util/pool/default_test.go | 4 +- util/pool/options.go | 2 +- util/pool/pool.go | 4 +- util/rand/rand.go | 2 +- util/reflect/reflect.go | 2 +- util/reflect/struct_test.go | 2 +- util/register/util.go | 6 +- util/register/util_test.go | 2 +- util/ring/buffer.go | 4 +- util/socket/socket.go | 4 +- util/stream/stream.go | 10 ++-- util/test/sqlmock_test.go | 25 ++++++++ util/test/test.go | 81 ++++++++++++++++++++++++++ 122 files changed, 426 insertions(+), 317 deletions(-) create mode 100644 util/test/sqlmock_test.go create mode 100644 util/test/test.go diff --git a/README.md b/README.md index db9826d4..b8c484c4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Micro [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Doc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/unistack-org/micro/v3?tab=overview) [![Status](https://github.com/unistack-org/micro/workflows/build/badge.svg?branch=master)](https://github.com/unistack-org/micro/actions?query=workflow%3Abuild+branch%3Amaster+event%3Apush) [![Lint](https://goreportcard.com/badge/go.unistack.org/micro/v3)](https://goreportcard.com/report/go.unistack.org/micro/v3) [![Coverage](https://codecov.io/gh/unistack-org/micro/branch/v3/graph/badge.svg?token=OZPO2LP7VS)](https://codecov.io/gh/unistack-org/micro) +# Micro [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Doc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/go.unistack.org/micro/v4?tab=overview) [![Status](https://github.com/unistack-org/micro/workflows/build/badge.svg?branch=master)](https://github.com/unistack-org/micro/actions?query=workflow%3Abuild+branch%3Amaster+event%3Apush) [![Lint](https://goreportcard.com/badge/go.unistack.org/micro/v4)](https://goreportcard.com/report/go.unistack.org/micro/v4) [![Coverage](https://codecov.io/gh/unistack-org/micro/branch/v4/graph/badge.svg?token=OZPO2LP7VS)](https://codecov.io/gh/unistack-org/micro) Micro is a standard library for microservices. diff --git a/broker/broker.go b/broker/broker.go index f95de4b4..35fc1eb7 100644 --- a/broker/broker.go +++ b/broker/broker.go @@ -1,12 +1,12 @@ // Package broker is an interface used for asynchronous messaging -package broker // import "go.unistack.org/micro/v3/broker" +package broker // import "go.unistack.org/micro/v4/broker" import ( "context" "errors" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/metadata" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/metadata" ) // DefaultBroker default memory broker diff --git a/broker/memory.go b/broker/memory.go index cd723118..015a40fc 100644 --- a/broker/memory.go +++ b/broker/memory.go @@ -4,12 +4,12 @@ import ( "context" "sync" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/metadata" - maddr "go.unistack.org/micro/v3/util/addr" - "go.unistack.org/micro/v3/util/id" - mnet "go.unistack.org/micro/v3/util/net" - "go.unistack.org/micro/v3/util/rand" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/metadata" + maddr "go.unistack.org/micro/v4/util/addr" + "go.unistack.org/micro/v4/util/id" + mnet "go.unistack.org/micro/v4/util/net" + "go.unistack.org/micro/v4/util/rand" ) type memoryBroker struct { diff --git a/broker/memory_test.go b/broker/memory_test.go index af949ede..575ec26e 100644 --- a/broker/memory_test.go +++ b/broker/memory_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "go.unistack.org/micro/v3/metadata" + "go.unistack.org/micro/v4/metadata" ) func TestMemoryBatchBroker(t *testing.T) { diff --git a/broker/options.go b/broker/options.go index 0e4a8c75..6a1d6a5a 100644 --- a/broker/options.go +++ b/broker/options.go @@ -5,11 +5,11 @@ import ( "crypto/tls" "time" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/register" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/register" + "go.unistack.org/micro/v4/tracer" ) // Options struct diff --git a/client/backoff.go b/client/backoff.go index 7eaacf7e..be625f69 100644 --- a/client/backoff.go +++ b/client/backoff.go @@ -5,7 +5,7 @@ import ( "math" "time" - "go.unistack.org/micro/v3/util/backoff" + "go.unistack.org/micro/v4/util/backoff" ) // BackoffFunc is the backoff call func diff --git a/client/client.go b/client/client.go index 6d60aef0..5f9e195d 100644 --- a/client/client.go +++ b/client/client.go @@ -1,12 +1,12 @@ // Package client is an interface for an RPC client -package client // import "go.unistack.org/micro/v3/client" +package client // import "go.unistack.org/micro/v4/client" import ( "context" "time" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/metadata" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/metadata" ) var ( diff --git a/client/lookup.go b/client/lookup.go index 5c409ba1..4c5183a1 100644 --- a/client/lookup.go +++ b/client/lookup.go @@ -4,8 +4,8 @@ import ( "context" "sort" - "go.unistack.org/micro/v3/errors" - "go.unistack.org/micro/v3/router" + "go.unistack.org/micro/v4/errors" + "go.unistack.org/micro/v4/router" ) // LookupFunc is used to lookup routes for a service diff --git a/client/noop.go b/client/noop.go index dfcf9025..64e15da2 100644 --- a/client/noop.go +++ b/client/noop.go @@ -5,11 +5,11 @@ import ( "fmt" "time" - "go.unistack.org/micro/v3/broker" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/errors" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/selector" + "go.unistack.org/micro/v4/broker" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/errors" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/selector" ) // DefaultCodecs will be used to encode/decode data diff --git a/client/options.go b/client/options.go index d4f976d4..977b4a44 100644 --- a/client/options.go +++ b/client/options.go @@ -6,17 +6,17 @@ import ( "net" "time" - "go.unistack.org/micro/v3/broker" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/network/transport" - "go.unistack.org/micro/v3/register" - "go.unistack.org/micro/v3/router" - "go.unistack.org/micro/v3/selector" - "go.unistack.org/micro/v3/selector/random" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/broker" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/network/transport" + "go.unistack.org/micro/v4/register" + "go.unistack.org/micro/v4/router" + "go.unistack.org/micro/v4/selector" + "go.unistack.org/micro/v4/selector/random" + "go.unistack.org/micro/v4/tracer" ) // Options holds client options diff --git a/client/retry.go b/client/retry.go index a218b3fe..de0c67ad 100644 --- a/client/retry.go +++ b/client/retry.go @@ -3,7 +3,7 @@ package client import ( "context" - "go.unistack.org/micro/v3/errors" + "go.unistack.org/micro/v4/errors" ) // RetryFunc that returning either false or a non-nil error will result in the call not being retried diff --git a/client/retry_test.go b/client/retry_test.go index 621c427d..c23df9d6 100644 --- a/client/retry_test.go +++ b/client/retry_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "go.unistack.org/micro/v3/errors" + "go.unistack.org/micro/v4/errors" ) func TestRetryAlways(t *testing.T) { diff --git a/client/test_request.go b/client/test_request.go index a42e2f47..8a0e87e8 100644 --- a/client/test_request.go +++ b/client/test_request.go @@ -1,7 +1,7 @@ package client import ( - "go.unistack.org/micro/v3/codec" + "go.unistack.org/micro/v4/codec" ) type testRequest struct { diff --git a/codec/codec.go b/codec/codec.go index 20231315..2383a119 100644 --- a/codec/codec.go +++ b/codec/codec.go @@ -1,11 +1,11 @@ // Package codec is an interface for encoding messages -package codec // import "go.unistack.org/micro/v3/codec" +package codec // import "go.unistack.org/micro/v4/codec" import ( "errors" "io" - "go.unistack.org/micro/v3/metadata" + "go.unistack.org/micro/v4/metadata" ) // Message types diff --git a/codec/frame.proto b/codec/frame.proto index 69dc556a..c4103538 100644 --- a/codec/frame.proto +++ b/codec/frame.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Unistack LLC +// Copyright 2021-2023 Unistack LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ syntax = "proto3"; package micro.codec; option cc_enable_arenas = true; -option go_package = "go.unistack.org/micro/v3/codec;codec"; +option go_package = "go.unistack.org/micro/v4/codec;codec"; option java_multiple_files = true; option java_outer_classname = "MicroCodec"; option java_package = "micro.codec"; diff --git a/codec/options.go b/codec/options.go index afcfb1c5..834e762a 100644 --- a/codec/options.go +++ b/codec/options.go @@ -3,9 +3,9 @@ package codec import ( "context" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/tracer" ) // Option func diff --git a/config/config.go b/config/config.go index ea00fd74..743dcefb 100644 --- a/config/config.go +++ b/config/config.go @@ -1,5 +1,5 @@ // Package config is an interface for dynamic configuration. -package config // import "go.unistack.org/micro/v3/config" +package config // import "go.unistack.org/micro/v4/config" import ( "context" diff --git a/config/default.go b/config/default.go index b28269f4..c7e68469 100644 --- a/config/default.go +++ b/config/default.go @@ -8,8 +8,8 @@ import ( "time" "github.com/imdario/mergo" - rutil "go.unistack.org/micro/v3/util/reflect" - mtime "go.unistack.org/micro/v3/util/time" + rutil "go.unistack.org/micro/v4/util/reflect" + mtime "go.unistack.org/micro/v4/util/time" ) type defaultConfig struct { @@ -169,7 +169,7 @@ func fillValue(value reflect.Value, val string) error { return err } value.Set(reflect.ValueOf(v)) - case value.Type().String() == "time.Duration" && value.Type().PkgPath() == "go.unistack.org/micro/v3/util/time": + case value.Type().String() == "time.Duration" && value.Type().PkgPath() == "go.unistack.org/micro/v4/util/time": v, err := mtime.ParseDuration(val) if err != nil { return err diff --git a/config/default_test.go b/config/default_test.go index 180d687e..4ee8df7d 100644 --- a/config/default_test.go +++ b/config/default_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "go.unistack.org/micro/v3/config" - mtime "go.unistack.org/micro/v3/util/time" + "go.unistack.org/micro/v4/config" + mtime "go.unistack.org/micro/v4/util/time" ) type cfg struct { diff --git a/config/options.go b/config/options.go index 66c86f90..c64e9361 100644 --- a/config/options.go +++ b/config/options.go @@ -4,10 +4,10 @@ import ( "context" "time" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/tracer" ) // Options hold the config options diff --git a/errors/errors.go b/errors/errors.go index 0a16c85b..40663c06 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -1,6 +1,6 @@ // Package errors provides a way to return detailed information // for an RPC request error. The error is normally JSON encoded. -package errors // import "go.unistack.org/micro/v3/errors" +package errors // import "go.unistack.org/micro/v4/errors" import ( "bytes" diff --git a/errors/errors.proto b/errors/errors.proto index 76164b86..0d7e4eb5 100644 --- a/errors/errors.proto +++ b/errors/errors.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Unistack LLC +// Copyright 2021-2023 Unistack LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ syntax = "proto3"; package micro.errors; option cc_enable_arenas = true; -option go_package = "go.unistack.org/micro/v3/errors;errors"; +option go_package = "go.unistack.org/micro/v4/errors;errors"; option java_multiple_files = true; option java_outer_classname = "MicroErrors"; option java_package = "micro.errors"; diff --git a/event.go b/event.go index d64d1f06..1e4116d6 100644 --- a/event.go +++ b/event.go @@ -3,7 +3,7 @@ package micro import ( "context" - "go.unistack.org/micro/v3/client" + "go.unistack.org/micro/v4/client" ) // Event is used to publish messages to a topic diff --git a/flow/default.go b/flow/default.go index af0e018a..299211b5 100644 --- a/flow/default.go +++ b/flow/default.go @@ -6,12 +6,12 @@ import ( "sync" "github.com/silas/dag" - "go.unistack.org/micro/v3/client" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/store" - "go.unistack.org/micro/v3/util/id" + "go.unistack.org/micro/v4/client" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/store" + "go.unistack.org/micro/v4/util/id" ) type microFlow struct { diff --git a/flow/flow.go b/flow/flow.go index 0124db3b..4f36c5f8 100644 --- a/flow/flow.go +++ b/flow/flow.go @@ -1,5 +1,5 @@ // Package flow is an interface used for saga pattern microservice workflow -package flow // import "go.unistack.org/micro/v3/flow" +package flow // import "go.unistack.org/micro/v4/flow" import ( "context" @@ -7,7 +7,7 @@ import ( "sync" "sync/atomic" - "go.unistack.org/micro/v3/metadata" + "go.unistack.org/micro/v4/metadata" ) var ( diff --git a/flow/options.go b/flow/options.go index 2e03b561..a40f3abd 100644 --- a/flow/options.go +++ b/flow/options.go @@ -4,11 +4,11 @@ import ( "context" "time" - "go.unistack.org/micro/v3/client" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/store" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/client" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/store" + "go.unistack.org/micro/v4/tracer" ) // Option func diff --git a/fsm/fsm.go b/fsm/fsm.go index 2cee6b1c..09dc76f6 100644 --- a/fsm/fsm.go +++ b/fsm/fsm.go @@ -1,4 +1,4 @@ -package fsm // import "go.unistack.org/micro/v3/fsm" +package fsm // import "go.unistack.org/micro/v4/fsm" import ( "context" diff --git a/fsm/fsm_test.go b/fsm/fsm_test.go index ad7d706e..800b2d91 100644 --- a/fsm/fsm_test.go +++ b/fsm/fsm_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "go.unistack.org/micro/v3/logger" + "go.unistack.org/micro/v4/logger" ) func TestFSMStart(t *testing.T) { diff --git a/go.mod b/go.mod index 55853a55..5eea8d9b 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,9 @@ -module go.unistack.org/micro/v3 +module go.unistack.org/micro/v4 -go 1.19 +go 1.20 require ( + github.com/DATA-DOG/go-sqlmock v1.5.0 github.com/imdario/mergo v0.3.14 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/silas/dag v0.0.0-20211117232152-9d50aa809f35 diff --git a/go.sum b/go.sum index 40151841..2abd2422 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= +github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/imdario/mergo v0.3.14 h1:fOqeC1+nCuuk6PKQdg9YmosXX7Y7mHX6R/0ZldI9iHo= github.com/imdario/mergo v0.3.14/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= diff --git a/logger/logger.go b/logger/logger.go index 425bedfe..f3232750 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -1,5 +1,5 @@ // Package logger provides a log interface -package logger // import "go.unistack.org/micro/v3/logger" +package logger // import "go.unistack.org/micro/v4/logger" import ( "context" diff --git a/logger/unwrap/unwrap.go b/logger/unwrap/unwrap.go index 93be44d4..e13844fb 100644 --- a/logger/unwrap/unwrap.go +++ b/logger/unwrap/unwrap.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "go.unistack.org/micro/v3/codec" + "go.unistack.org/micro/v4/codec" ) const sf = "0-+# " diff --git a/logger/unwrap/unwrap_test.go b/logger/unwrap/unwrap_test.go index 3161c342..ed740af9 100644 --- a/logger/unwrap/unwrap_test.go +++ b/logger/unwrap/unwrap_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "go.unistack.org/micro/v3/codec" + "go.unistack.org/micro/v4/codec" ) func TestUnwrap(t *testing.T) { diff --git a/logger/wrapper/wrapper.go b/logger/wrapper/wrapper.go index ee96f5c6..c2631bd2 100644 --- a/logger/wrapper/wrapper.go +++ b/logger/wrapper/wrapper.go @@ -5,9 +5,9 @@ import ( "context" "fmt" - "go.unistack.org/micro/v3/client" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/server" + "go.unistack.org/micro/v4/client" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/server" ) var ( diff --git a/metadata/metadata.go b/metadata/metadata.go index 5cb23b9b..18b5a2f9 100644 --- a/metadata/metadata.go +++ b/metadata/metadata.go @@ -1,5 +1,5 @@ // Package metadata is a way of defining message headers -package metadata // import "go.unistack.org/micro/v3/metadata" +package metadata // import "go.unistack.org/micro/v4/metadata" import ( "net/textproto" diff --git a/meter/meter.go b/meter/meter.go index 71da6914..059fc2f8 100644 --- a/meter/meter.go +++ b/meter/meter.go @@ -1,5 +1,5 @@ // Package meter is for instrumentation -package meter // import "go.unistack.org/micro/v3/meter" +package meter // import "go.unistack.org/micro/v4/meter" import ( "io" diff --git a/meter/options.go b/meter/options.go index 14bcfc69..be077429 100644 --- a/meter/options.go +++ b/meter/options.go @@ -3,7 +3,7 @@ package meter import ( "context" - "go.unistack.org/micro/v3/logger" + "go.unistack.org/micro/v4/logger" ) // Option powers the configuration for metrics implementations: diff --git a/meter/wrapper/wrapper.go b/meter/wrapper/wrapper.go index 00ca68df..979dac27 100644 --- a/meter/wrapper/wrapper.go +++ b/meter/wrapper/wrapper.go @@ -1,13 +1,13 @@ -package wrapper // import "go.unistack.org/micro/v3/meter/wrapper" +package wrapper // import "go.unistack.org/micro/v4/meter/wrapper" import ( "context" "fmt" "time" - "go.unistack.org/micro/v3/client" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/server" + "go.unistack.org/micro/v4/client" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/server" ) var ( diff --git a/mtls/mtls.go b/mtls/mtls.go index 238be41b..f1a6e941 100644 --- a/mtls/mtls.go +++ b/mtls/mtls.go @@ -1,4 +1,4 @@ -package mtls // import "go.unistack.org/micro/v3/mtls" +package mtls // import "go.unistack.org/micro/v4/mtls" import ( "bytes" diff --git a/network/network.go b/network/network.go index 9e00e9de..25c9c221 100644 --- a/network/network.go +++ b/network/network.go @@ -1,9 +1,9 @@ // Package network is for creating internetworks -package network // import "go.unistack.org/micro/v3/network" +package network // import "go.unistack.org/micro/v4/network" import ( - "go.unistack.org/micro/v3/client" - "go.unistack.org/micro/v3/server" + "go.unistack.org/micro/v4/client" + "go.unistack.org/micro/v4/server" ) // Error is network node errors diff --git a/network/options.go b/network/options.go index d4c68c6a..e7b196c2 100644 --- a/network/options.go +++ b/network/options.go @@ -1,13 +1,13 @@ package network import ( - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/network/tunnel" - "go.unistack.org/micro/v3/proxy" - "go.unistack.org/micro/v3/router" - "go.unistack.org/micro/v3/tracer" - "go.unistack.org/micro/v3/util/id" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/network/tunnel" + "go.unistack.org/micro/v4/proxy" + "go.unistack.org/micro/v4/router" + "go.unistack.org/micro/v4/tracer" + "go.unistack.org/micro/v4/util/id" ) // Option func diff --git a/network/transport/memory.go b/network/transport/memory.go index 209e885e..6447978f 100644 --- a/network/transport/memory.go +++ b/network/transport/memory.go @@ -8,9 +8,9 @@ import ( "sync" "time" - maddr "go.unistack.org/micro/v3/util/addr" - mnet "go.unistack.org/micro/v3/util/net" - "go.unistack.org/micro/v3/util/rand" + maddr "go.unistack.org/micro/v4/util/addr" + mnet "go.unistack.org/micro/v4/util/net" + "go.unistack.org/micro/v4/util/rand" ) type memorySocket struct { diff --git a/network/transport/options.go b/network/transport/options.go index 723fea35..6ab32d4b 100644 --- a/network/transport/options.go +++ b/network/transport/options.go @@ -5,10 +5,10 @@ import ( "crypto/tls" "time" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/tracer" ) // Options struct holds the transport options diff --git a/network/transport/transport.go b/network/transport/transport.go index f70f34b9..b8005a97 100644 --- a/network/transport/transport.go +++ b/network/transport/transport.go @@ -1,11 +1,11 @@ // Package transport is an interface for synchronous connection based communication -package transport // import "go.unistack.org/micro/v3/network/transport" +package transport // import "go.unistack.org/micro/v4/network/transport" import ( "context" "time" - "go.unistack.org/micro/v3/metadata" + "go.unistack.org/micro/v4/metadata" ) var ( diff --git a/network/tunnel/broker/broker.go b/network/tunnel/broker/broker.go index ea14c1f9..75001fb2 100644 --- a/network/tunnel/broker/broker.go +++ b/network/tunnel/broker/broker.go @@ -1,15 +1,15 @@ // Package broker is a tunnel broker -package broker // import "go.unistack.org/micro/v3/network/tunnel/broker" +package broker // import "go.unistack.org/micro/v4/network/tunnel/broker" import ( "context" "fmt" - "go.unistack.org/micro/v3/broker" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/network/transport" - "go.unistack.org/micro/v3/network/tunnel" + "go.unistack.org/micro/v4/broker" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/network/transport" + "go.unistack.org/micro/v4/network/tunnel" ) type tunBroker struct { diff --git a/network/tunnel/options.go b/network/tunnel/options.go index e3f33e97..fbb5570b 100644 --- a/network/tunnel/options.go +++ b/network/tunnel/options.go @@ -3,11 +3,11 @@ package tunnel import ( "time" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/network/transport" - "go.unistack.org/micro/v3/tracer" - "go.unistack.org/micro/v3/util/id" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/network/transport" + "go.unistack.org/micro/v4/tracer" + "go.unistack.org/micro/v4/util/id" ) var ( diff --git a/network/tunnel/transport/listener.go b/network/tunnel/transport/listener.go index 1a29a760..eb506e48 100644 --- a/network/tunnel/transport/listener.go +++ b/network/tunnel/transport/listener.go @@ -1,8 +1,8 @@ package transport import ( - "go.unistack.org/micro/v3/network/transport" - "go.unistack.org/micro/v3/network/tunnel" + "go.unistack.org/micro/v4/network/transport" + "go.unistack.org/micro/v4/network/tunnel" ) type tunListener struct { diff --git a/network/tunnel/transport/transport.go b/network/tunnel/transport/transport.go index e5e6f68b..87959a79 100644 --- a/network/tunnel/transport/transport.go +++ b/network/tunnel/transport/transport.go @@ -1,12 +1,12 @@ // Package transport provides a tunnel transport -package transport // import "go.unistack.org/micro/v3/network/tunnel/transport" +package transport // import "go.unistack.org/micro/v4/network/tunnel/transport" import ( "context" "fmt" - "go.unistack.org/micro/v3/network/transport" - "go.unistack.org/micro/v3/network/tunnel" + "go.unistack.org/micro/v4/network/transport" + "go.unistack.org/micro/v4/network/tunnel" ) type tunTransport struct { diff --git a/network/tunnel/tunnel.go b/network/tunnel/tunnel.go index 3efa9294..c6d36aef 100644 --- a/network/tunnel/tunnel.go +++ b/network/tunnel/tunnel.go @@ -1,12 +1,12 @@ // Package tunnel provides gre network tunnelling -package tunnel // import "go.unistack.org/micro/v3/network/transport/tunnel" +package tunnel // import "go.unistack.org/micro/v4/network/transport/tunnel" import ( "context" "errors" "time" - "go.unistack.org/micro/v3/network/transport" + "go.unistack.org/micro/v4/network/transport" ) // DefaultTunnel contains default tunnel implementation diff --git a/options.go b/options.go index 37164a71..c5746152 100644 --- a/options.go +++ b/options.go @@ -5,17 +5,17 @@ import ( "fmt" "time" - "go.unistack.org/micro/v3/broker" - "go.unistack.org/micro/v3/client" - "go.unistack.org/micro/v3/config" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/register" - "go.unistack.org/micro/v3/router" - "go.unistack.org/micro/v3/server" - "go.unistack.org/micro/v3/store" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/broker" + "go.unistack.org/micro/v4/client" + "go.unistack.org/micro/v4/config" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/register" + "go.unistack.org/micro/v4/router" + "go.unistack.org/micro/v4/server" + "go.unistack.org/micro/v4/store" + "go.unistack.org/micro/v4/tracer" ) // Options for micro service diff --git a/options/hooks.go b/options/hooks.go index 48a45ad2..7192f5fe 100644 --- a/options/hooks.go +++ b/options/hooks.go @@ -1,4 +1,4 @@ -package options // import "go.unistack.org/micro/v3/options" +package options // import "go.unistack.org/micro/v4/options" // Hook func interface type Hook interface{} diff --git a/profiler/http/http.go b/profiler/http/http.go index d0fa4a80..45974dd0 100644 --- a/profiler/http/http.go +++ b/profiler/http/http.go @@ -1,5 +1,5 @@ // Package http enables the http profiler -package http // import "go.unistack.org/micro/v3/profiler/http" +package http // import "go.unistack.org/micro/v4/profiler/http" import ( "context" @@ -7,7 +7,7 @@ import ( "net/http/pprof" "sync" - profile "go.unistack.org/micro/v3/profiler" + profile "go.unistack.org/micro/v4/profiler" ) type httpProfile struct { diff --git a/profiler/pprof/pprof.go b/profiler/pprof/pprof.go index 1c8fbdce..10f66540 100644 --- a/profiler/pprof/pprof.go +++ b/profiler/pprof/pprof.go @@ -1,5 +1,5 @@ // Package pprof provides a pprof profiler which writes output to /tmp/[name].{cpu,mem}.pprof -package pprof // import "go.unistack.org/micro/v3/profiler/pprof" +package pprof // import "go.unistack.org/micro/v4/profiler/pprof" import ( "os" @@ -9,7 +9,7 @@ import ( "sync" "time" - profile "go.unistack.org/micro/v3/profiler" + profile "go.unistack.org/micro/v4/profiler" ) type profiler struct { diff --git a/profiler/profile.go b/profiler/profile.go index b29eb600..50899492 100644 --- a/profiler/profile.go +++ b/profiler/profile.go @@ -1,5 +1,5 @@ // Package profiler is for profilers -package profiler // import "go.unistack.org/micro/v3/profiler" +package profiler // import "go.unistack.org/micro/v4/profiler" // Profiler interface type Profiler interface { diff --git a/proxy/options.go b/proxy/options.go index 0b0fe0c8..f1d01271 100644 --- a/proxy/options.go +++ b/proxy/options.go @@ -2,11 +2,11 @@ package proxy import ( - "go.unistack.org/micro/v3/client" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/router" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/client" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/router" + "go.unistack.org/micro/v4/tracer" ) // Options for proxy diff --git a/proxy/proxy.go b/proxy/proxy.go index e80c1e9a..b58bcc74 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -1,10 +1,10 @@ // Package proxy is a transparent proxy built on the micro/server -package proxy // import "go.unistack.org/micro/v3/proxy" +package proxy // import "go.unistack.org/micro/v4/proxy" import ( "context" - "go.unistack.org/micro/v3/server" + "go.unistack.org/micro/v4/server" ) // DefaultEndpoint holds default proxy address diff --git a/register/extractor.go b/register/extractor.go index 923729af..13c932af 100644 --- a/register/extractor.go +++ b/register/extractor.go @@ -6,7 +6,7 @@ import ( "unicode" "unicode/utf8" - "go.unistack.org/micro/v3/metadata" + "go.unistack.org/micro/v4/metadata" ) // ExtractValue from reflect.Type from specified depth diff --git a/register/memory.go b/register/memory.go index 85e8b468..6c86ce2a 100644 --- a/register/memory.go +++ b/register/memory.go @@ -5,8 +5,8 @@ import ( "sync" "time" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/util/id" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/util/id" ) var ( diff --git a/register/options.go b/register/options.go index 4e903c7a..7da9fd70 100644 --- a/register/options.go +++ b/register/options.go @@ -5,9 +5,9 @@ import ( "crypto/tls" "time" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/tracer" ) // Options holds options for register diff --git a/register/register.go b/register/register.go index 30055da1..74526544 100644 --- a/register/register.go +++ b/register/register.go @@ -1,11 +1,11 @@ // Package register is an interface for service discovery -package register // import "go.unistack.org/micro/v3/register" +package register // import "go.unistack.org/micro/v4/register" import ( "context" "errors" - "go.unistack.org/micro/v3/metadata" + "go.unistack.org/micro/v4/metadata" ) const ( diff --git a/resolver/dns/dns.go b/resolver/dns/dns.go index 82de80d5..a49720d4 100644 --- a/resolver/dns/dns.go +++ b/resolver/dns/dns.go @@ -1,5 +1,5 @@ // Package dns resolves names to dns records -package dns // import "go.unistack.org/micro/v3/resolver/dns" +package dns // import "go.unistack.org/micro/v4/resolver/dns" import ( "context" @@ -7,7 +7,7 @@ import ( "sync" "time" - "go.unistack.org/micro/v3/resolver" + "go.unistack.org/micro/v4/resolver" ) // Resolver is a DNS network resolve diff --git a/resolver/dnssrv/dnssrv.go b/resolver/dnssrv/dnssrv.go index f88f816f..7a4ae3df 100644 --- a/resolver/dnssrv/dnssrv.go +++ b/resolver/dnssrv/dnssrv.go @@ -1,11 +1,11 @@ // Package dnssrv resolves names to dns srv records -package dnssrv // import "go.unistack.org/micro/v3/resolver/dnssrv" +package dnssrv // import "go.unistack.org/micro/v4/resolver/dnssrv" import ( "fmt" "net" - "go.unistack.org/micro/v3/resolver" + "go.unistack.org/micro/v4/resolver" ) // Resolver is a DNS network resolve diff --git a/resolver/http/http.go b/resolver/http/http.go index 8aa8e43e..6d1c7e18 100644 --- a/resolver/http/http.go +++ b/resolver/http/http.go @@ -1,5 +1,5 @@ // Package http resolves names to network addresses using a http request -package http // import "go.unistack.org/micro/v3/resolver/http" +package http // import "go.unistack.org/micro/v4/resolver/http" import ( "encoding/json" @@ -8,7 +8,7 @@ import ( "net/http" "net/url" - "go.unistack.org/micro/v3/resolver" + "go.unistack.org/micro/v4/resolver" ) // nolint: golint,revive diff --git a/resolver/noop/noop.go b/resolver/noop/noop.go index 3fbe202e..496ddf58 100644 --- a/resolver/noop/noop.go +++ b/resolver/noop/noop.go @@ -1,8 +1,8 @@ // Package noop is a noop resolver -package noop // import "go.unistack.org/micro/v3/resolver/noop" +package noop // import "go.unistack.org/micro/v4/resolver/noop" import ( - "go.unistack.org/micro/v3/resolver" + "go.unistack.org/micro/v4/resolver" ) // Resolver contains noop resolver diff --git a/resolver/registry/registry.go b/resolver/registry/registry.go index 064f7b59..d477f23c 100644 --- a/resolver/registry/registry.go +++ b/resolver/registry/registry.go @@ -1,11 +1,11 @@ // Package register resolves names using the micro register -package register // import "go.unistack.org/micro/v3/resolver/registry" +package register // import "go.unistack.org/micro/v4/resolver/registry" import ( "context" - "go.unistack.org/micro/v3/register" - "go.unistack.org/micro/v3/resolver" + "go.unistack.org/micro/v4/register" + "go.unistack.org/micro/v4/resolver" ) // Resolver is a register network resolver diff --git a/resolver/resolver.go b/resolver/resolver.go index 7ba1f6cf..bdcb7f54 100644 --- a/resolver/resolver.go +++ b/resolver/resolver.go @@ -1,5 +1,5 @@ // Package resolver resolves network names to addresses -package resolver // import "go.unistack.org/micro/v3/resolver" +package resolver // import "go.unistack.org/micro/v4/resolver" // Resolver is network resolver. It's used to find network nodes // via the name to connect to. This is done based on Network.Name(). diff --git a/resolver/static/static.go b/resolver/static/static.go index 4985a89f..c2887062 100644 --- a/resolver/static/static.go +++ b/resolver/static/static.go @@ -1,8 +1,8 @@ // Package static is a static resolver -package static // import "go.unistack.org/micro/v3/resolver/static" +package static // import "go.unistack.org/micro/v4/resolver/static" import ( - "go.unistack.org/micro/v3/resolver" + "go.unistack.org/micro/v4/resolver" ) // Resolver returns a static list of nodes. In the event the node list diff --git a/router/options.go b/router/options.go index ab99475f..40575af1 100644 --- a/router/options.go +++ b/router/options.go @@ -3,9 +3,9 @@ package router import ( "context" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/register" - "go.unistack.org/micro/v3/util/id" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/register" + "go.unistack.org/micro/v4/util/id" ) // Options are router options diff --git a/router/route.go b/router/route.go index 94a7aaf9..97986bdf 100644 --- a/router/route.go +++ b/router/route.go @@ -3,7 +3,7 @@ package router import ( "hash/fnv" - "go.unistack.org/micro/v3/metadata" + "go.unistack.org/micro/v4/metadata" ) var ( diff --git a/router/router.go b/router/router.go index 2509b7c5..d2af571e 100644 --- a/router/router.go +++ b/router/router.go @@ -1,5 +1,5 @@ // Package router provides a network routing control plane -package router // import "go.unistack.org/micro/v3/router" +package router // import "go.unistack.org/micro/v4/router" import ( "errors" diff --git a/selector/random/random.go b/selector/random/random.go index 40b25daf..1c682079 100644 --- a/selector/random/random.go +++ b/selector/random/random.go @@ -1,8 +1,8 @@ -package random // import "go.unistack.org/micro/v3/selector/random" +package random // import "go.unistack.org/micro/v4/selector/random" import ( - "go.unistack.org/micro/v3/selector" - "go.unistack.org/micro/v3/util/rand" + "go.unistack.org/micro/v4/selector" + "go.unistack.org/micro/v4/util/rand" ) type random struct{} diff --git a/selector/random/random_test.go b/selector/random/random_test.go index 08a00f74..a43989a2 100644 --- a/selector/random/random_test.go +++ b/selector/random/random_test.go @@ -3,7 +3,7 @@ package random import ( "testing" - "go.unistack.org/micro/v3/selector" + "go.unistack.org/micro/v4/selector" ) func TestRandom(t *testing.T) { diff --git a/selector/roundrobin/roundrobin.go b/selector/roundrobin/roundrobin.go index f39aca5c..fec4c598 100644 --- a/selector/roundrobin/roundrobin.go +++ b/selector/roundrobin/roundrobin.go @@ -1,8 +1,8 @@ -package roundrobin // import "go.unistack.org/micro/v3/selector/roundrobin" +package roundrobin // import "go.unistack.org/micro/v4/selector/roundrobin" import ( - "go.unistack.org/micro/v3/selector" - "go.unistack.org/micro/v3/util/rand" + "go.unistack.org/micro/v4/selector" + "go.unistack.org/micro/v4/util/rand" ) // NewSelector returns an initialised round robin selector diff --git a/selector/roundrobin/roundrobin_test.go b/selector/roundrobin/roundrobin_test.go index fa80d637..a1f0d0e5 100644 --- a/selector/roundrobin/roundrobin_test.go +++ b/selector/roundrobin/roundrobin_test.go @@ -3,7 +3,7 @@ package roundrobin import ( "testing" - "go.unistack.org/micro/v3/selector" + "go.unistack.org/micro/v4/selector" ) func TestRoundRobin(t *testing.T) { diff --git a/selector/selector.go b/selector/selector.go index 2c16cca6..569097ef 100644 --- a/selector/selector.go +++ b/selector/selector.go @@ -1,5 +1,5 @@ // Package selector is for node selection and load balancing -package selector // import "go.unistack.org/micro/v3/selector" +package selector // import "go.unistack.org/micro/v4/selector" import ( "errors" diff --git a/server/errors.go b/server/errors.go index 637998f7..a41eb616 100644 --- a/server/errors.go +++ b/server/errors.go @@ -1,6 +1,6 @@ package server -import "go.unistack.org/micro/v3/errors" +import "go.unistack.org/micro/v4/errors" type Error struct { id string diff --git a/server/errors_test.go b/server/errors_test.go index ffd9bf19..51d0c9cb 100644 --- a/server/errors_test.go +++ b/server/errors_test.go @@ -3,7 +3,7 @@ package server import ( "testing" - "go.unistack.org/micro/v3/errors" + "go.unistack.org/micro/v4/errors" ) func TestError(t *testing.T) { diff --git a/server/handler.go b/server/handler.go index 8b99a0ff..58bf56fb 100644 --- a/server/handler.go +++ b/server/handler.go @@ -3,7 +3,7 @@ package server import ( "reflect" - "go.unistack.org/micro/v3/register" + "go.unistack.org/micro/v4/register" ) type rpcHandler struct { diff --git a/server/noop.go b/server/noop.go index 8334cd2e..e2be9a13 100644 --- a/server/noop.go +++ b/server/noop.go @@ -6,13 +6,13 @@ import ( "sync" "time" - "go.unistack.org/micro/v3/broker" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/register" - maddr "go.unistack.org/micro/v3/util/addr" - mnet "go.unistack.org/micro/v3/util/net" - "go.unistack.org/micro/v3/util/rand" + "go.unistack.org/micro/v4/broker" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/register" + maddr "go.unistack.org/micro/v4/util/addr" + mnet "go.unistack.org/micro/v4/util/net" + "go.unistack.org/micro/v4/util/rand" ) // DefaultCodecs will be used to encode/decode diff --git a/server/noop_test.go b/server/noop_test.go index 5ecc762d..a5f659ae 100644 --- a/server/noop_test.go +++ b/server/noop_test.go @@ -5,12 +5,12 @@ import ( "fmt" "testing" - "go.unistack.org/micro/v3/broker" - "go.unistack.org/micro/v3/client" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/server" + "go.unistack.org/micro/v4/broker" + "go.unistack.org/micro/v4/client" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/server" ) type TestHandler struct { diff --git a/server/options.go b/server/options.go index 8ab8c0d2..efd441ac 100644 --- a/server/options.go +++ b/server/options.go @@ -7,16 +7,16 @@ import ( "sync" "time" - "go.unistack.org/micro/v3/broker" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/network/transport" - "go.unistack.org/micro/v3/options" - "go.unistack.org/micro/v3/register" - "go.unistack.org/micro/v3/tracer" - "go.unistack.org/micro/v3/util/id" + "go.unistack.org/micro/v4/broker" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/network/transport" + "go.unistack.org/micro/v4/options" + "go.unistack.org/micro/v4/register" + "go.unistack.org/micro/v4/tracer" + "go.unistack.org/micro/v4/util/id" ) // Option func diff --git a/server/registry.go b/server/registry.go index f9539522..024aaf52 100644 --- a/server/registry.go +++ b/server/registry.go @@ -4,10 +4,10 @@ import ( "net" "time" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/register" - "go.unistack.org/micro/v3/util/addr" - "go.unistack.org/micro/v3/util/backoff" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/register" + "go.unistack.org/micro/v4/util/addr" + "go.unistack.org/micro/v4/util/backoff" ) var ( diff --git a/server/request.go b/server/request.go index 6b20e988..b032dcfb 100644 --- a/server/request.go +++ b/server/request.go @@ -1,8 +1,8 @@ package server import ( - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/metadata" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/metadata" ) type rpcMessage struct { diff --git a/server/server.go b/server/server.go index ef710d79..cb79f946 100644 --- a/server/server.go +++ b/server/server.go @@ -1,13 +1,13 @@ // Package server is an interface for a micro server -package server // import "go.unistack.org/micro/v3/server" +package server // import "go.unistack.org/micro/v4/server" import ( "context" "time" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/register" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/register" ) // DefaultServer default server diff --git a/server/subscriber.go b/server/subscriber.go index 54b7a964..7d30c8f8 100644 --- a/server/subscriber.go +++ b/server/subscriber.go @@ -10,12 +10,12 @@ import ( "unicode" "unicode/utf8" - "go.unistack.org/micro/v3/broker" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/errors" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/register" + "go.unistack.org/micro/v4/broker" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/errors" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/register" ) const ( diff --git a/service.go b/service.go index 60165ced..4de9fd4a 100644 --- a/service.go +++ b/service.go @@ -1,20 +1,20 @@ // Package micro is a pluggable framework for microservices -package micro // import "go.unistack.org/micro/v3" +package micro // import "go.unistack.org/micro/v4" import ( "fmt" "sync" - "go.unistack.org/micro/v3/broker" - "go.unistack.org/micro/v3/client" - "go.unistack.org/micro/v3/config" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/register" - "go.unistack.org/micro/v3/router" - "go.unistack.org/micro/v3/server" - "go.unistack.org/micro/v3/store" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/broker" + "go.unistack.org/micro/v4/client" + "go.unistack.org/micro/v4/config" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/register" + "go.unistack.org/micro/v4/router" + "go.unistack.org/micro/v4/server" + "go.unistack.org/micro/v4/store" + "go.unistack.org/micro/v4/tracer" ) // Service is an interface that wraps the lower level components. diff --git a/service_test.go b/service_test.go index 1b96cb0d..c6df0a3a 100644 --- a/service_test.go +++ b/service_test.go @@ -5,16 +5,16 @@ import ( "reflect" "testing" - "go.unistack.org/micro/v3/broker" - "go.unistack.org/micro/v3/client" - "go.unistack.org/micro/v3/config" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/register" - "go.unistack.org/micro/v3/router" - "go.unistack.org/micro/v3/server" - "go.unistack.org/micro/v3/store" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/broker" + "go.unistack.org/micro/v4/client" + "go.unistack.org/micro/v4/config" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/register" + "go.unistack.org/micro/v4/router" + "go.unistack.org/micro/v4/server" + "go.unistack.org/micro/v4/store" + "go.unistack.org/micro/v4/tracer" ) type testItem struct { diff --git a/store/memory_test.go b/store/memory_test.go index da8a9ad0..9e738247 100644 --- a/store/memory_test.go +++ b/store/memory_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "go.unistack.org/micro/v3/store" + "go.unistack.org/micro/v4/store" ) func TestMemoryReInit(t *testing.T) { diff --git a/store/options.go b/store/options.go index 586969c3..dea99ec0 100644 --- a/store/options.go +++ b/store/options.go @@ -5,11 +5,11 @@ import ( "crypto/tls" "time" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/tracer" ) // Options contains configuration for the Store diff --git a/store/store.go b/store/store.go index 251c2ba0..708f97bf 100644 --- a/store/store.go +++ b/store/store.go @@ -1,5 +1,5 @@ // Package store is an interface for distributed data storage. -package store // import "go.unistack.org/micro/v3/store" +package store // import "go.unistack.org/micro/v4/store" import ( "context" diff --git a/sync/options.go b/sync/options.go index b964d2cb..010fc36b 100644 --- a/sync/options.go +++ b/sync/options.go @@ -3,9 +3,9 @@ package sync import ( "time" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/meter" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/micro/v4/meter" + "go.unistack.org/micro/v4/tracer" ) // Options holds the sync options diff --git a/sync/sync.go b/sync/sync.go index 42329514..c74e9d9c 100644 --- a/sync/sync.go +++ b/sync/sync.go @@ -1,5 +1,5 @@ // Package sync is an interface for distributed synchronization -package sync // import "go.unistack.org/micro/v3/sync" +package sync // import "go.unistack.org/micro/v4/sync" import ( "errors" diff --git a/tracer/options.go b/tracer/options.go index cf8c88f6..ff43b342 100644 --- a/tracer/options.go +++ b/tracer/options.go @@ -3,7 +3,7 @@ package tracer import ( "context" - "go.unistack.org/micro/v3/logger" + "go.unistack.org/micro/v4/logger" ) type SpanStatus int diff --git a/tracer/tracer.go b/tracer/tracer.go index daecd53e..46e08033 100644 --- a/tracer/tracer.go +++ b/tracer/tracer.go @@ -1,5 +1,5 @@ // Package tracer provides an interface for distributed tracing -package tracer // import "go.unistack.org/micro/v3/tracer" +package tracer // import "go.unistack.org/micro/v4/tracer" import ( "context" diff --git a/tracer/wrapper/wrapper.go b/tracer/wrapper/wrapper.go index fba21743..ba2548d2 100644 --- a/tracer/wrapper/wrapper.go +++ b/tracer/wrapper/wrapper.go @@ -1,14 +1,14 @@ // Package wrapper provides wrapper for Tracer -package wrapper // import "go.unistack.org/micro/v3/tracer/wrapper" +package wrapper // import "go.unistack.org/micro/v4/tracer/wrapper" import ( "context" "fmt" - "go.unistack.org/micro/v3/client" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/server" - "go.unistack.org/micro/v3/tracer" + "go.unistack.org/micro/v4/client" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/server" + "go.unistack.org/micro/v4/tracer" ) var ( diff --git a/util/addr/addr.go b/util/addr/addr.go index 47e5636f..77308c8d 100644 --- a/util/addr/addr.go +++ b/util/addr/addr.go @@ -1,4 +1,4 @@ -package addr // import "go.unistack.org/micro/v3/util/addr" +package addr // import "go.unistack.org/micro/v4/util/addr" import ( "fmt" diff --git a/util/backoff/backoff.go b/util/backoff/backoff.go index a18c6a52..fc81fda2 100644 --- a/util/backoff/backoff.go +++ b/util/backoff/backoff.go @@ -1,5 +1,5 @@ // Package backoff provides backoff functionality -package backoff // import "go.unistack.org/micro/v3/util/backoff" +package backoff // import "go.unistack.org/micro/v4/util/backoff" import ( "math" diff --git a/util/buf/buf.go b/util/buf/buf.go index f01a9d6a..d2abb5c9 100644 --- a/util/buf/buf.go +++ b/util/buf/buf.go @@ -1,4 +1,4 @@ -package buf // import "go.unistack.org/micro/v3/util/buf" +package buf // import "go.unistack.org/micro/v4/util/buf" import ( "bytes" diff --git a/util/http/http.go b/util/http/http.go index de83f138..01daae9a 100644 --- a/util/http/http.go +++ b/util/http/http.go @@ -1,4 +1,4 @@ -package http // import "go.unistack.org/micro/v3/util/http" +package http // import "go.unistack.org/micro/v4/util/http" import ( "context" @@ -8,8 +8,8 @@ import ( "net/http" "strings" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/selector/random" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/selector/random" ) // Write sets the status and body on a http ResponseWriter diff --git a/util/http/http_test.go b/util/http/http_test.go index 6547f215..a55fbfb3 100644 --- a/util/http/http_test.go +++ b/util/http/http_test.go @@ -9,10 +9,10 @@ import ( "net/http" "testing" - "go.unistack.org/micro/v3/register" - "go.unistack.org/micro/v3/register/memory" - "go.unistack.org/micro/v3/router" - regRouter "go.unistack.org/micro/v3/router/register" + "go.unistack.org/micro/v4/register" + "go.unistack.org/micro/v4/register/memory" + "go.unistack.org/micro/v4/router" + regRouter "go.unistack.org/micro/v4/router/register" ) func TestRoundTripper(t *testing.T) { diff --git a/util/http/options.go b/util/http/options.go index 961fcf82..e0ef0d23 100644 --- a/util/http/options.go +++ b/util/http/options.go @@ -1,6 +1,6 @@ package http -import "go.unistack.org/micro/v3/router" +import "go.unistack.org/micro/v4/router" // Options struct type Options struct { diff --git a/util/http/roundtripper.go b/util/http/roundtripper.go index da7f9c8b..b90f887f 100644 --- a/util/http/roundtripper.go +++ b/util/http/roundtripper.go @@ -4,8 +4,8 @@ import ( "errors" "net/http" - "go.unistack.org/micro/v3/router" - "go.unistack.org/micro/v3/selector" + "go.unistack.org/micro/v4/router" + "go.unistack.org/micro/v4/selector" ) type roundTripper struct { diff --git a/util/id/id.go b/util/id/id.go index f4699e6e..8bd9c0d8 100644 --- a/util/id/id.go +++ b/util/id/id.go @@ -1,4 +1,4 @@ -package id // import "go.unistack.org/micro/v3/util/id" +package id // import "go.unistack.org/micro/v4/util/id" import ( "context" @@ -6,7 +6,7 @@ import ( "errors" "math" - "go.unistack.org/micro/v3/logger" + "go.unistack.org/micro/v4/logger" ) // DefaultAlphabet is the alphabet used for ID characters by default diff --git a/util/io/io.go b/util/io/io.go index 54599523..ad13bf34 100644 --- a/util/io/io.go +++ b/util/io/io.go @@ -1,10 +1,10 @@ // Package io is for io management -package io // import "go.unistack.org/micro/v3/util/io" +package io // import "go.unistack.org/micro/v4/util/io" import ( "io" - "go.unistack.org/micro/v3/network/transport" + "go.unistack.org/micro/v4/network/transport" ) type rwc struct { diff --git a/util/jitter/random.go b/util/jitter/random.go index eb03b29f..b7228d33 100644 --- a/util/jitter/random.go +++ b/util/jitter/random.go @@ -1,10 +1,10 @@ // Package jitter provides a random jitter -package jitter // import "go.unistack.org/micro/v3/util/jitter" +package jitter // import "go.unistack.org/micro/v4/util/jitter" import ( "time" - "go.unistack.org/micro/v3/util/rand" + "go.unistack.org/micro/v4/util/rand" ) // Random returns a random time to jitter with max cap specified diff --git a/util/jitter/ticker.go b/util/jitter/ticker.go index 84946556..cd923896 100644 --- a/util/jitter/ticker.go +++ b/util/jitter/ticker.go @@ -1,10 +1,10 @@ -package jitter // import "go.unistack.org/micro/v3/util/jitter" +package jitter // import "go.unistack.org/micro/v4/util/jitter" import ( "context" "time" - "go.unistack.org/micro/v3/util/rand" + "go.unistack.org/micro/v4/util/rand" ) // Ticker is similar to time.Ticker but ticks at random intervals between diff --git a/util/net/net.go b/util/net/net.go index a5e8e278..a78110cb 100644 --- a/util/net/net.go +++ b/util/net/net.go @@ -1,4 +1,4 @@ -package net // import "go.unistack.org/micro/v3/util/net" +package net // import "go.unistack.org/micro/v4/util/net" import ( "errors" diff --git a/util/pki/pki.go b/util/pki/pki.go index 681821bf..37c37495 100644 --- a/util/pki/pki.go +++ b/util/pki/pki.go @@ -1,6 +1,6 @@ // Package pki provides PKI all the PKI functions necessary to run micro over an untrusted network // including a CA -package pki // import "go.unistack.org/micro/v3/util/pki" +package pki // import "go.unistack.org/micro/v4/util/pki" import ( "bytes" diff --git a/util/pool/default.go b/util/pool/default.go index 7f61c281..9ccd4d27 100644 --- a/util/pool/default.go +++ b/util/pool/default.go @@ -5,8 +5,8 @@ import ( "sync" "time" - "go.unistack.org/micro/v3/network/transport" - "go.unistack.org/micro/v3/util/id" + "go.unistack.org/micro/v4/network/transport" + "go.unistack.org/micro/v4/util/id" ) type pool struct { diff --git a/util/pool/default_test.go b/util/pool/default_test.go index 7fab0f6b..8ef74c4c 100644 --- a/util/pool/default_test.go +++ b/util/pool/default_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "go.unistack.org/micro/v3/network/transport" - "go.unistack.org/micro/v3/network/transport/memory" + "go.unistack.org/micro/v4/network/transport" + "go.unistack.org/micro/v4/network/transport/memory" ) func testPool(t *testing.T, size int, ttl time.Duration) { diff --git a/util/pool/options.go b/util/pool/options.go index 3edfc310..c6df3949 100644 --- a/util/pool/options.go +++ b/util/pool/options.go @@ -3,7 +3,7 @@ package pool import ( "time" - "go.unistack.org/micro/v3/network/transport" + "go.unistack.org/micro/v4/network/transport" ) // Options struct diff --git a/util/pool/pool.go b/util/pool/pool.go index 576d1873..329027a7 100644 --- a/util/pool/pool.go +++ b/util/pool/pool.go @@ -1,11 +1,11 @@ // Package pool is a connection pool -package pool // import "go.unistack.org/micro/v3/util/pool" +package pool // import "go.unistack.org/micro/v4/util/pool" import ( "context" "time" - "go.unistack.org/micro/v3/network/transport" + "go.unistack.org/micro/v4/network/transport" ) // Pool is an interface for connection pooling diff --git a/util/rand/rand.go b/util/rand/rand.go index 3df9701c..ebd516dc 100644 --- a/util/rand/rand.go +++ b/util/rand/rand.go @@ -1,4 +1,4 @@ -package rand // import "go.unistack.org/micro/v3/util/rand" +package rand // import "go.unistack.org/micro/v4/util/rand" import ( crand "crypto/rand" diff --git a/util/reflect/reflect.go b/util/reflect/reflect.go index 3caa6034..031dcc72 100644 --- a/util/reflect/reflect.go +++ b/util/reflect/reflect.go @@ -1,4 +1,4 @@ -package reflect // import "go.unistack.org/micro/v3/util/reflect" +package reflect // import "go.unistack.org/micro/v4/util/reflect" import ( "errors" diff --git a/util/reflect/struct_test.go b/util/reflect/struct_test.go index 00da531d..510d7a3a 100644 --- a/util/reflect/struct_test.go +++ b/util/reflect/struct_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - rutil "go.unistack.org/micro/v3/util/reflect" + rutil "go.unistack.org/micro/v4/util/reflect" ) func TestStructFields(t *testing.T) { diff --git a/util/register/util.go b/util/register/util.go index e3867389..c235920b 100644 --- a/util/register/util.go +++ b/util/register/util.go @@ -1,11 +1,11 @@ -package register // import "go.unistack.org/micro/v3/util/register" +package register // import "go.unistack.org/micro/v4/util/register" import ( "context" "time" - "go.unistack.org/micro/v3/register" - jitter "go.unistack.org/micro/v3/util/jitter" + "go.unistack.org/micro/v4/register" + jitter "go.unistack.org/micro/v4/util/jitter" ) func addNodes(old, neu []*register.Node) []*register.Node { diff --git a/util/register/util_test.go b/util/register/util_test.go index cea37b72..c0979210 100644 --- a/util/register/util_test.go +++ b/util/register/util_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "go.unistack.org/micro/v3/register" + "go.unistack.org/micro/v4/register" ) func TestRemove(t *testing.T) { diff --git a/util/ring/buffer.go b/util/ring/buffer.go index 50fe2499..f332f7af 100644 --- a/util/ring/buffer.go +++ b/util/ring/buffer.go @@ -1,11 +1,11 @@ // Package ring provides a simple ring buffer for storing local data -package ring // import "go.unistack.org/micro/v3/util/ring" +package ring // import "go.unistack.org/micro/v4/util/ring" import ( "sync" "time" - "go.unistack.org/micro/v3/util/id" + "go.unistack.org/micro/v4/util/id" ) // Buffer is ring buffer diff --git a/util/socket/socket.go b/util/socket/socket.go index 1797a71a..a686c511 100644 --- a/util/socket/socket.go +++ b/util/socket/socket.go @@ -1,10 +1,10 @@ // Package socket provides a pseudo socket -package socket // import "go.unistack.org/micro/v3/util/socket" +package socket // import "go.unistack.org/micro/v4/util/socket" import ( "io" - "go.unistack.org/micro/v3/network/transport" + "go.unistack.org/micro/v4/network/transport" ) // Socket is our pseudo socket for transport.Socket diff --git a/util/stream/stream.go b/util/stream/stream.go index 5e51df98..f6b2022f 100644 --- a/util/stream/stream.go +++ b/util/stream/stream.go @@ -1,14 +1,14 @@ // Package stream encapsulates streams within streams -package stream // import "go.unistack.org/micro/v3/util/stream" +package stream // import "go.unistack.org/micro/v4/util/stream" import ( "context" "sync" - "go.unistack.org/micro/v3/client" - "go.unistack.org/micro/v3/codec" - "go.unistack.org/micro/v3/metadata" - "go.unistack.org/micro/v3/server" + "go.unistack.org/micro/v4/client" + "go.unistack.org/micro/v4/codec" + "go.unistack.org/micro/v4/metadata" + "go.unistack.org/micro/v4/server" ) // Stream interface diff --git a/util/test/sqlmock_test.go b/util/test/sqlmock_test.go new file mode 100644 index 00000000..6d238f26 --- /dev/null +++ b/util/test/sqlmock_test.go @@ -0,0 +1,25 @@ +package test + +import ( + "fmt" + "strings" + "testing" + + "github.com/DATA-DOG/go-sqlmock" +) + +func Test_NewSQLRowsFromFile(t *testing.T) { + db, c, err := sqlmock.New() + if err != nil { + t.Fatal(err) + } + defer db.Close() + + rows, err := NewSQLRowsFromFile(c, "testdata/Call.csv") + if err != nil { + t.Fatal(err) + } + if !strings.Contains(fmt.Sprintf("%#+v", rows), `cols:[]string{"DepAgrId", "DepAgrNum", "DepAgrDate", "DepAgrCloseDate", "AccCur", "MainFinaccNum", "MainFinaccName", "MainFinaccId", "MainFinaccOpenDt", "DepAgrStatus", "MainFinaccBal", "DepartCode", "CardAccId"}`) { + t.Fatal("invalid cols after import csv") + } +} diff --git a/util/test/test.go b/util/test/test.go new file mode 100644 index 00000000..a92acc52 --- /dev/null +++ b/util/test/test.go @@ -0,0 +1,81 @@ +package test + +import ( + "encoding/csv" + "errors" + "os" + "path" + "strings" + + "github.com/DATA-DOG/go-sqlmock" + "go.unistack.org/micro/v4/client" + "go.unistack.org/micro/v4/codec" +) + +var ErrUnknownContentType = errors.New("unknown content type") + +type Extension struct { + Ext []string +} + +var ExtToTypes = map[string][]string{ + "json": {"application/json", "application/grpc+json"}, + "yaml": {"application/yaml", "application/yml", "text/yaml", "text/yml"}, + "yml": {"application/yaml", "application/yml", "text/yaml", "text/yml"}, + "proto": {"application/grpc", "application/grpc+proto", "application/proto"}, +} + +func NewRequestFromFile(c client.Client, reqfile string) (client.Request, error) { + reqbuf, err := os.ReadFile(reqfile) + if err != nil { + return nil, err + } + + endpoint := path.Base(path.Dir(reqfile)) + ext := path.Ext(reqfile) + if len(ext) > 0 && ext[0] == '.' { + ext = ext[1:] + } + + var ct string + if cts, ok := ExtToTypes[ext]; ok { + for _, t := range cts { + if _, ok = c.Options().Codecs[t]; ok { + ct = t + break + } + } + } + + if ct == "" { + return nil, ErrUnknownContentType + } + + req := c.NewRequest("test", endpoint, &codec.Frame{Data: reqbuf}, client.RequestContentType(ct)) + + return req, nil +} + +func NewSQLRowsFromFile(c sqlmock.Sqlmock, file string) (*sqlmock.Rows, error) { + fp, err := os.Open(file) + if err != nil { + return nil, err + } + defer fp.Close() + + r := csv.NewReader(fp) + r.Comma = '\t' + r.Comment = '#' + + records, err := r.ReadAll() + if err != nil { + return nil, err + } + + rows := c.NewRows(records[0]) + for idx := 1; idx < len(records); idx++ { + rows.FromCSVString(strings.Join(records[idx], ";")) + } + + return rows, nil +}