Documentation Index
Fetch the complete documentation index at: https://docs.cyborg.co/llms.txt
Use this file to discover all available pages before exploring further.
This action is irreversible. Proceed with caution.
Deletes the current index and all its associated data from the CyborgDB service.
func (e *EncryptedIndex) DeleteIndex(ctx context.Context) error
Parameters
| Parameter | Type | Description |
|---|
ctx | context.Context | Context for cancellation and timeouts |
Error Handling
- Returns error if the API request fails due to network connectivity issues
- Returns error if authentication fails (invalid API key)
- Returns error if the encryption key is invalid for the specified index
- Returns error if there are internal server errors during deletion
- Returns error if the index does not exist
- May return error if the index is currently being accessed by other operations
Example Usage
package main
import (
"context"
"encoding/hex"
"fmt"
"log"
"github.com/cyborginc/cyborgdb-go"
)
func main() {
client, err := cyborgdb.NewClient("http://localhost:8000", "your-api-key")
if err != nil {
log.Fatal(err)
}
// Load the index to be deleted
indexKeyHex := "your-64-character-hex-key-here"
indexKey, err := hex.DecodeString(indexKeyHex)
if err != nil {
log.Fatal(err)
}
index, err := client.LoadIndex(context.Background(), "index-to-delete", indexKey)
if err != nil {
log.Fatal(err)
}
// Permanently delete the entire index
fmt.Printf("Deleting index: %s\n", index.GetIndexName())
err = index.DeleteIndex(context.Background())
if err != nil {
log.Fatalf("Failed to delete index: %v", err)
}
fmt.Println("Index deleted successfully!")
// The index handle is now invalid and should not be used
}