Files
milvus/client
congqixiaandGitHub 8e8e793c2a enhance: [GoSDK] support pointer types for nullable columns in row-based API (#47712)
Related to #47711

Enable Go pointer struct fields (*string, *int32, etc.) to represent
nullable columns in the row-based data processing path. A nil pointer
maps to a NULL value in Milvus; a non-nil pointer dereferences to the
actual value.

Changes:
- ParseSchema: pointer fields auto-infer Nullable=true (PK excluded)
- AnyToColumns: use reflect.Value.IsNil() to call AppendNull for nil
pointers, Elem().Interface() for non-nil — bypasses Go's typed-nil
problem where (*T)(nil) as interface{} is != nil
- SetField: wrap/unwrap pointer values during field assignment
- fillData/fillPKEntry: check IsNull() on columns and set nil pointers
for null values, wrap non-null values in reflect.New pointers
- Dynamic field path: same nil/deref logic for pointer fields going into
the JSON dynamic column

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
2026-02-10 18:48:42 +08:00
..

Go MilvusClient

license Go Reference

Go MilvusClient for Milvus. To contribute code to this project, please read our contribution guidelines first.

Getting started

Prerequisites

Go 1.24.12 or higher

Install Milvus Go SDK

  1. Use go get to install the latest version of the Milvus Go SDK and dependencies:

    go get -u github.com/milvus-io/milvus/client/v2
    
  2. Include the Go MilvusClient in your application:

     import "github.com/milvus-io/milvus/client/v2/milvusclient"
    
     //...other snippet ...
     ctx, cancel := context.WithCancel(context.Background())
     defer cancel()
    
     milvusAddr := "YOUR_MILVUS_ENDPOINT"
    
     cli, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
     	Address: milvusAddr,
     })
     if err != nil {
     	// handle error
     }
    
     // Do your work with milvus client
    

API Documentation

Refer to https://milvus.io/api-reference/go/v2.5.x/About.md for the Go SDK API documentation.

Code format

The Go source code is formatted using gci & gofumpt. Please run make lint-fix before sumbit a PR.