CreatePartition()
This method creates a partition in a specific collection.
func (c *GrpcClient) CreatePartition(ctx context.Context, collName string, partitionName string) error
Request Parameters
Parameter |
Description |
Type |
---|---|---|
|
Context for the current call to work. |
|
|
Name of a collection |
|
|
Name of the partition to create. |
|
Return
Null
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 already exists.
The call to this API fails.
Example
// create partition
errPar := mc.CreatePartition(context.Background(), collectionName, "p1")
if errPar != nil {
log.Fatal("failed to create partition:", errPar.Error())
}