BulkImportResponse
A BulkImportResponse instance is the response returned by the BulkImport() package function. It embeds ResponseBase for the common Status and Message fields, and exposes the assigned import job ID under Data.JobID. Use the embedded CheckStatus() method to verify the call succeeded before reading Data.
type BulkImportResponse struct {
ResponseBase
Data struct {
JobID string
}
FIELDS:
-
Status (int) -
Inherited from
ResponseBase. A value of0indicates success; any other value indicates an error. -
Message (string) -
Inherited from
ResponseBase. Human-readable error description whenStatusis non-zero. -
Data.JobID (string) -
The unique identifier assigned to the submitted bulk import job. Pass this to
GetImportProgress()to track completion.
BUILDER METHODS:
-
CheckStatus()This validates the response status. Returns nil when
Status == 0; otherwise returns a formatted error containingStatusandMessage.
Example
Demonstrates BulkImportResponse usage.
import (
"context"
"github.com/milvus-io/milvus/client/v3/milvusclient"
)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
cli, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
Address: "YOUR_CLUSTER_ENDPOINT",
})
if err != nil {
// handle error
}
defer cli.Close(ctx)
resp, err := milvusclient.BulkImport(ctx, milvusclient.NewBulkImportOption("milvus-bulk-imp", "https://example.com/rows.json"))
if err != nil {
// handle error
}
if err := resp.CheckStatus(); err != nil {
// handle non-zero status
}
fmt.Println(resp.Data.JobID)