move to micro v4 #109

Merged
vtolstov merged 1 commits from v4 into master 2023-04-28 22:29:45 +03:00
9 changed files with 30 additions and 36 deletions

View File

@ -5,14 +5,14 @@ This plugin is a http client for micro.
## Overview
The http client wraps `net/http` to provide a robust micro client with service discovery, load balancing and streaming.
It complies with the [micro.Client](https://godoc.org/go.unistack.org/micro-client-http/v3#Client) interface.
It complies with the [micro.Client](https://godoc.org/go.unistack.org/micro-client-http/v4#Client) interface.
## Usage
### Use directly
```go
import "go.unistack.org/micro-client-http/v3"
import "go.unistack.org/micro-client-http/v4"
service := micro.NewService(
micro.Name("my.service"),

6
go.mod
View File

@ -1,5 +1,5 @@
module go.unistack.org/micro-client-http/v3
module go.unistack.org/micro-client-http/v4
go 1.18
go 1.19
require go.unistack.org/micro/v3 v3.10.16
require go.unistack.org/micro/v4 v4.0.1

10
go.sum
View File

@ -1,8 +1,2 @@
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/silas/dag v0.0.0-20211117232152-9d50aa809f35/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
go.unistack.org/micro/v3 v3.10.16 h1:2er/SKKYbV60M+UuJM4eYCF0MZYAIq/yNUrAbTfgq8Q=
go.unistack.org/micro/v3 v3.10.16/go.mod h1:uMAc0U/x7dmtICCrblGf0ZLgYegu3VwQAquu+OFCw1Q=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
go.unistack.org/micro/v4 v4.0.1 h1:xo1IxbVfgh8i0eY0VeYa3cbb13u5n/Mxnp3FOgWD4Jo=
go.unistack.org/micro/v4 v4.0.1/go.mod h1:p/J5UcSJjfHsWGT31uKoghQ5rUQZzQJBAFy+Z4+ZVMs=

18
http.go
View File

@ -1,5 +1,5 @@
// Package http provides a http client
package http // import "go.unistack.org/micro-client-http/v3"
package http // import "go.unistack.org/micro-client-http/v4"
import (
"bufio"
@ -15,14 +15,14 @@ import (
"sync"
"time"
"go.unistack.org/micro/v3/broker"
"go.unistack.org/micro/v3/client"
"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/selector"
rutil "go.unistack.org/micro/v3/util/reflect"
"go.unistack.org/micro/v4/broker"
"go.unistack.org/micro/v4/client"
"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/selector"
rutil "go.unistack.org/micro/v4/util/reflect"
)
var DefaultContentType = "application/json"

View File

@ -1,8 +1,8 @@
package http
import (
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/metadata"
"go.unistack.org/micro/v4/client"
"go.unistack.org/micro/v4/metadata"
)
type httpMessage struct {

View File

@ -4,8 +4,8 @@ import (
"net"
"net/http"
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/metadata"
"go.unistack.org/micro/v4/client"
"go.unistack.org/micro/v4/metadata"
)
var (

View File

@ -1,8 +1,8 @@
package http
import (
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/codec"
"go.unistack.org/micro/v4/client"
"go.unistack.org/micro/v4/codec"
)
type httpRequest struct {

View File

@ -9,10 +9,10 @@ import (
"net/http"
"sync"
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/codec"
"go.unistack.org/micro/v3/errors"
"go.unistack.org/micro/v3/logger"
"go.unistack.org/micro/v4/client"
"go.unistack.org/micro/v4/codec"
"go.unistack.org/micro/v4/errors"
"go.unistack.org/micro/v4/logger"
)
// Implements the streamer interface

View File

@ -10,10 +10,10 @@ import (
"strings"
"sync"
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/errors"
"go.unistack.org/micro/v3/logger"
rutil "go.unistack.org/micro/v3/util/reflect"
"go.unistack.org/micro/v4/client"
"go.unistack.org/micro/v4/errors"
"go.unistack.org/micro/v4/logger"
rutil "go.unistack.org/micro/v4/util/reflect"
)
var (