MCPcopy
hub / github.com/dgraph-io/dgraph / newClient

Function newClient

dgraph/cmd/dgraphimport/import_client.go:29–41  ·  view source on GitHub ↗

newClient creates a new import client with the specified endpoint and gRPC options.

(connectionString string)

Source from the content-addressed store, hash-verified

27
28// newClient creates a new import client with the specified endpoint and gRPC options.
29func newClient(connectionString string) (api.DgraphClient, error) {
30 if connectionString == "" {
31 return nil, fmt.Errorf("connection string cannot be empty")
32 }
33
34 dg, err := dgo.Open(connectionString)
35 if err != nil {
36 return nil, fmt.Errorf("failed to connect to endpoint [%s]: %w", connectionString, err)
37 }
38
39 glog.Infof("[import] Successfully connected to Dgraph endpoint: %s", connectionString)
40 return dg.GetAPIClients()[0], nil
41}
42
43func Import(ctx context.Context, connectionString string, bulkOutDir string) error {
44 if bulkOutDir == "" {

Calls 3

InfofMethod · 0.80
OpenMethod · 0.65
ErrorfMethod · 0.45