DropDatabase
This operation drops a database and all its collections permanently.
go
func (c *Client) DropDatabase(ctx context.Context, option DropDatabaseOption, callOptions ...grpc.CallOption) error
Request Syntax
Creates the request for DropDatabase().
go
option := milvusclient.NewDropDatabaseOption(dbName)
err := client.DropDatabase(ctx, option)
PARAMETERS:
-
dbName (string) -
[REQUIRED]
The name of the database.
BUILDER METHODS:
-
NewDropDatabaseOption(dbName string)Creates the request for DropDatabase().
RETURN TYPE:
error
RETURNS:
Returns nil on success, or an error describing what went wrong.
ERROR HANDLING:
-
error
The operation fails. Check
err != nilfor failure details.
Example
Demonstrates DropDatabase() usage.
go
import (
"context"
"github.com/milvus-io/milvus/client/v3/milvusclient"
)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
cli, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
Address: "YOUR_CLUSTER_ENDPOINT",
})
if err != nil {
// handle err
}
defer cli.Close(ctx)
err = cli.DropDatabase(ctx, milvusclient.NewDropDatabaseOption("test_db"))
if err != nil {
// handle err
}