Lists all vector IDs currently stored in the encrypted index.
func (e *EncryptedIndex) ListIDs(ctx context.Context) (*ListIDsResponse, error)

Parameters

ParameterTypeDescription
ctxcontext.ContextContext for cancellation and timeouts

Returns

  • *ListIDsResponse: Contains all vector IDs:
    • Ids: Slice of all vector ID strings in the index
  • error: Any error encountered during the operation

Error Handling

Example Usage

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/cyborginc/cyborgdb-go"
)

func main() {
    client, err := cyborgdb.NewClient(cyborgdb.ClientConfig{
        BaseURL: "http://localhost:8000",
        APIKey:  "your-api-key",
    })
    if err != nil {
        log.Fatal(err)
    }

    // Load an existing index
    indexKey := "your-64-character-hex-key"
    index, err := client.LoadIndex(context.Background(), cyborgdb.LoadIndexParams{
        IndexName: "my-vector-index",
        IndexKey:  indexKey,
    })
    if err != nil {
        log.Fatal(err)
    }

    // List all vector IDs
    response, err := index.ListIDs(context.Background())
    if err != nil {
        log.Fatalf("ListIDs failed: %v", err)
    }

    fmt.Printf("Index contains %d vectors:\n", len(response.Ids))
    for i, id := range response.Ids {
        fmt.Printf("%d. %s\n", i+1, id)
        
        // Limit output for large indexes
        if i >= 9 && len(response.Ids) > 10 {
            fmt.Printf("... and %d more\n", len(response.Ids)-10)
            break
        }
    }
}