跳到主要内容
版本:v2.5.x

ListPartitions()

This method lists all existing partitions in a specific collection.

Go
func (c *Client) ListPartitions(ctx context.Context, opt ListPartitionsOption, callOptions ...grpc.CallOption) (partitionNames []string, err error)

Request Parameters​

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

option

Optional parameters of the methods.

ListPartitionsOption

callOpts

Optional parameters for calling the methods.

grpc.CallOption

ListPartitionsOption​

This is an interface type. The listPartitionsOpt struct type implements this interface type.

You can use the NewListPartitionOption() function to get the concrete implementation.

NewListPartitionOption​

The signature of this method is as follows:

Go
func NewListPartitionOption(collectionName string) *listPartitionsOpt

Return​

[]string

Example​

Go
import (
"context"
"github.com/milvus-io/milvus/client/v2/milvusclient"
)

partitionNames, err := cli.ListPartitions(ctx, milvusclient.NewListPartitionOption("quick_setup"))
if err != nil {
// handle error
}

fmt.Println(partitionNames)