collection

package
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CollectionCmd = &cobra.Command{
	Use:     "collection",
	Aliases: []string{"col", "cols"},
	Short:   "Collection management",
	Long: `Manage vector database collections.

This command provides subcommands to list, view, and delete collections.`,
}

CollectionCmd represents the collection command

View Source
var CountCmd = &cobra.Command{
	Use:     "count",
	Aliases: []string{"c"},
	Short:   "Count collections",
	Long: `Count the number of collections in the vector database.

This command returns the total number of collections.

Example:
  weave collection count`,
	Args: cobra.NoArgs,
	Run:  runCollectionCount,
}

CountCmd represents the collection count command

View Source
var CreateCmd = &cobra.Command{
	Use:     "create COLLECTION_NAME",
	Aliases: []string{"c"},
	Short:   "Create a collection",
	Long: `Create a new collection in the vector database.

This command creates a collection with the specified name and schema.
You can use a named schema from config.yaml, specify a schema file,
or use custom fields and embedding model.

Examples:
  # Create collection using a named schema from config.yaml
  weave collection create MyDocsCol --schema RagMeDocs
  weave collection create MyImagesCol --schema RagMeImages

  # Create collection from a YAML schema file
  weave collection create MyCollection --schema-yaml-file schema.yaml

  # Create collection with default schema
  weave collection create MyCollection
  weave collection create MyCollection --embedding-model text-embedding-ada-002
  weave collection create MyCollection --fields "title:string,description:text"`,
	Args: cobra.ExactArgs(1),
	Run:  runCollectionCreate,
}

CreateCmd represents the collection create command

View Source
var DeleteAllCmd = &cobra.Command{
	Use:     "delete-all",
	Aliases: []string{"da"},
	Short:   "Clear all collections (delete all documents)",
	Long: `Clear all collections by deleting all documents from them.

⚠️  WARNING: This is a destructive operation that will permanently
delete ALL documents in ALL collections. The collection schemas will
remain but will be empty. Use with extreme caution!

This command requires double confirmation:
1. First confirmation: Standard y/N prompt
2. Second confirmation: Red warning requiring exact "yes" input

Use --force to skip confirmations in scripts.

Example:
  weave collection delete-all`,
	Args: cobra.NoArgs,
	Run:  runCollectionDeleteAll,
}

DeleteAllCmd represents the collection delete-all command

View Source
var DeleteCmd = &cobra.Command{
	Use:     "delete COLLECTION_NAME [COLLECTION_NAME...]",
	Aliases: []string{"del", "d"},
	Short:   "Clear one or more collections (delete all documents)",
	Long: `Clear one or more collections by deleting all documents from them.

⚠️  WARNING: This is a destructive operation that will permanently
delete all documents in the specified collection(s). The collection
schema will remain but will be empty. Use with caution!

You can specify collections in multiple ways:
1. By collection name(s): weave cols delete MyCollection
2. By pattern: weave cols delete --pattern "WeaveDocs*"
3. By multiple names: weave cols delete Collection1 Collection2 Collection3

Pattern types (auto-detected):
- Shell glob: WeaveDocs*, Test*, *Docs
- Regex: WeaveDocs.*, ^Test.*$, .*Docs$

Examples:
  weave collection delete MyCollection
  weave collection delete Collection1 Collection2 Collection3
  weave collection delete --pattern "WeaveDocs*"`,
	Args: cobra.MinimumNArgs(1),
	Run:  runCollectionDelete,
}

DeleteCmd represents the collection delete command

View Source
var DeleteSchemaCmd = &cobra.Command{
	Use:     "delete-schema COLLECTION_NAME",
	Aliases: []string{"ds"},
	Short:   "Delete collection schema",
	Long: `Delete the schema of a collection.

This command removes the schema definition from the collection.
The collection and its documents will remain, but the schema will be deleted.

⚠️  WARNING: This is a destructive operation that will permanently
delete the schema definition. Use with caution!

This command requires double confirmation:
1. First confirmation: Standard y/N prompt
2. Second confirmation: Red warning requiring exact "yes" input

Use --force to skip confirmations in scripts.

Example:
  weave collection delete-schema MyCollection`,
	Args: cobra.ExactArgs(1),
	Run:  runCollectionDeleteSchema,
}

DeleteSchemaCmd represents the collection delete-schema command

View Source
var ListCmd = &cobra.Command{
	Use:     "list [database-name]",
	Aliases: []string{"ls", "l"},
	Short:   "List all collections",
	Long: `List all collections in the configured vector database.

This command shows:
- Collection names
- Document counts (if available)
- Collection metadata (if available)

If no database name is provided, it uses the default database.
Use 'weave config list' to see all available databases.`,
	Run: runCollectionList,
}

ListCmd represents the collection list command

View Source
var ShowCmd = &cobra.Command{
	Use:     "show COLLECTION_NAME",
	Aliases: []string{"s"},
	Short:   "Show collection details",
	Long: `Show detailed information about a collection.

This command displays:
- Collection schema
- Metadata information
- Document count
- Field definitions

Example:
  weave collection show MyCollection`,
	Args: cobra.ExactArgs(1),
	Run:  runCollectionShow,
}

ShowCmd represents the collection show command

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL