Skip to main content

HasPartition()

This method checks whether a specific partition exists.

func (c *GrpcClient) HasPartition(ctx context.Context, collName string, partitionName string) (bool, error)

Request Parameters

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

collName

Name of a collection

string

partitionName

Name of the partition to check.

string

Return

A boolean value indicating whether the specified partition exists.

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.

  • A partition with the specified name does not exist.

  • The call to this API fails.

Example

// has partition
has, errPar := mc.HasPartition(context.Background(), collectionName, "p1")
if errPar != nil {
log.Fatal("failed to has partition:", errPar.Error())
}
log.Println(has)