Skip to content

Commit

Permalink
use grpc.NewClient after grpc.Dial deprecation (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
jairad26 authored Aug 15, 2024
1 parent b9db548 commit f897ee6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ distribution of workload.
The following code snippet shows just one connection.

```go
conn, err := grpc.Dial("localhost:9080", grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.NewClient("localhost:9080", grpc.WithTransportCredentials(insecure.NewCredentials()))
// Check error
defer conn.Close()
dgraphClient := dgo.NewDgraphClient(api.NewDgraphClient(conn))
Expand All @@ -76,7 +76,7 @@ The client can be configured to use gRPC compression:
dialOpts := append([]grpc.DialOption{},
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name)))
d, err := grpc.Dial("localhost:9080", dialOpts...)
d, err := grpc.NewClient("localhost:9080", dialOpts...)
```

### Login into a namespace
Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func DialCloud(endpoint, key string) (*grpc.ClientConn, error) {
return nil, err
}
creds := credentials.NewClientTLSFromCert(pool, "")
return grpc.Dial(
return grpc.NewClient(
grpcHost,
grpc.WithTransportCredentials(creds),
grpc.WithPerRPCCredentials(&authCreds{key}),
Expand Down
2 changes: 1 addition & 1 deletion examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
type CancelFunc func()

func getDgraphClient() (*dgo.Dgraph, CancelFunc) {
conn, err := grpc.Dial(dgraphAddress, grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.NewClient(dgraphAddress, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Fatal("While trying to dial gRPC")
}
Expand Down

0 comments on commit f897ee6

Please sign in to comment.