MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / Client

Method Client

dgraphtest/dcloud_cluster.go:64–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62}
63
64func (c *DCloudCluster) Client() (*dgraphapi.GrpcClient, func(), error) {
65 var conns []*grpc.ClientConn
66 conn, err := dgo.DialCloud(c.url, c.token)
67 if err != nil {
68 return nil, nil, errors.Wrap(err, "error creating dgraph client")
69 }
70 conns = append(conns, conn)
71
72 cleanup := func() {
73 for _, conn := range conns {
74 if err := conn.Close(); err != nil {
75 log.Printf("[WARNING] error closing connection: %v", err)
76 }
77 }
78 }
79 client := dgo.NewDgraphClient(api.NewDgraphClient(conn))
80 return &dgraphapi.GrpcClient{Dgraph: client}, cleanup, nil
81}
82
83func (c *DCloudCluster) HTTPClient() (*dgraphapi.HTTPClient, error) {
84 return nil, errNotImplemented

Callers 2

TestMainFunction · 0.95
initMethod · 0.95

Calls 1

CloseMethod · 0.65

Tested by 1

TestMainFunction · 0.76