newClient creates a new import client with the specified endpoint and gRPC options.
(connectionString string)
| 27 | |
| 28 | // newClient creates a new import client with the specified endpoint and gRPC options. |
| 29 | func 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 | |
| 43 | func Import(ctx context.Context, connectionString string, bulkOutDir string) error { |
| 44 | if bulkOutDir == "" { |