Returns the names of all encrypted indexes in your project.
func (c *Client) ListIndexes(ctx context.Context) ([]string, error)

Parameters

ParameterTypeDescription
ctxcontext.ContextContext for cancellation/timeouts

Returns

TypeDescription
[]stringList of index names (empty slice if no indexes exist)
errorAny error encountered during the operation

Exceptions

Example Usage

package main

import (
    "context"
    "fmt"
    "log"
    
    "github.com/cyborginc/cyborgdb-go"
)

func main() {
    // Create client
    client, err := cyborgdb.NewClient("http://localhost:8000", "your-api-key")
    if err != nil {
        log.Fatal(err)
    }
    
    // List all indexes
    ctx := context.Background()
    indexes, err := client.ListIndexes(ctx)
    if err != nil {
        log.Fatal("Failed to list indexes:", err)
    }
    
    if len(indexes) == 0 {
        fmt.Println("No indexes found")
        return
    }
    
    fmt.Printf("Found %d indexes:\n", len(indexes))
    for i, indexName := range indexes {
        fmt.Printf("%d. %s\n", i+1, indexName)
    }
}