Skip to main content

ShowPartitions()

This method returns a list of partitions within a specific collection.

func (c *GrpcClient) ShowPartitions(ctx context.Context, collName string) ([]*entity.Partition, error)

Request Parameters

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

collName

Name of a collection

string

Return

A list of entity.Partition or an error.

entity.Partition

This struct type defines the fields to include in the partition details.

type Partition struct {
ID int64 // partition id
Name string // partition name
Loaded bool // partition loaded
}

Errors

Any error in the execution of the request. Possible errors are as follows:

  • ErrClientNotReady: The client is not connected to Milvus.

  • ErrCollectionNotExists: The specified collection does not exist.

  • The call to this API fails.

Example

// show partitions
partitions, errPar := mc.ShowPartitions(context.Background(), collectionName)
if errPar != nil {
log.Fatal("failed to show partitions:", errPar.Error())
}
for _, p := range partitions {
log.Println(p.Name, p.ID)
}