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

RenameCollection()

This method renames the specified collection.

Go
func (c *Client) RenameCollection(ctx context.Context, option RenameCollectionOption, callOptions ...grpc.CallOption) error

Request Parameters​

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

option

Optional parameters of the methods.

RenameCollectionOption

callOpts

Optional parameters for calling the methods.

grpc.CallOption

RenameCollectionOption​

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

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

NewRenameCollectionOption​

The signature of this method is as follows:

Go
func NewRenameCollectionOption(oldName, newName string) *renameCollectionOption

Parameter

Description

Type

oldName

Original name of the collection to rename.

string

newName

New name of the collection after this operation.

string

Return​

Null

Example​

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

err = cli.RenameCollection(ctx, milvusclient.NewRenameCollectionOption("my_collection", "my_new_collection"))
if err != nil {
// handle error
}