mock

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: MIT Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a mock vector database client

func NewClient

func NewClient(config *config.MockConfig) *Client

NewClient creates a new mock client

func (*Client) AddDocument

func (c *Client) AddDocument(ctx context.Context, collectionName string, doc Document) error

AddDocument adds a document to a collection (for testing purposes)

func (*Client) CalculateMockScore added in v0.2.8

func (c *Client) CalculateMockScore(doc Document, queryWords []string) float64

CalculateMockScore calculates a mock similarity score based on keyword matching

func (*Client) CalculateMockScoreWithMetadata added in v0.2.8

func (c *Client) CalculateMockScoreWithMetadata(doc Document, queryWords []string, searchMetadata bool) float64

CalculateMockScoreWithMetadata calculates a mock similarity score based on keyword matching with optional metadata search

func (*Client) CountDocuments added in v0.2.0

func (c *Client) CountDocuments(ctx context.Context, collectionName string) (int, error)

CountDocuments returns the number of documents in a collection

func (*Client) CreateCollection added in v0.0.9

func (c *Client) CreateCollection(ctx context.Context, collectionName, embeddingModel string, customFields []weaviate.FieldDefinition) error

CreateCollection creates a new collection in the mock database

func (*Client) CreateDocument added in v0.0.9

func (c *Client) CreateDocument(ctx context.Context, collectionName string, document Document) error

CreateDocument creates a new document in the specified collection

func (*Client) DeleteAllDocuments added in v0.2.3

func (c *Client) DeleteAllDocuments(ctx context.Context, collectionName string) error

DeleteAllDocuments deletes all documents in a collection

func (*Client) DeleteCollection

func (c *Client) DeleteCollection(ctx context.Context, collectionName string) error

DeleteCollection deletes all objects from a collection

func (*Client) DeleteDocument

func (c *Client) DeleteDocument(ctx context.Context, collectionName, documentID string) error

DeleteDocument deletes a specific document by ID

func (*Client) DeleteDocumentsByMetadata added in v0.0.4

func (c *Client) DeleteDocumentsByMetadata(ctx context.Context, collectionName string, metadataFilters []string) (int, error)

DeleteDocumentsByMetadata deletes documents matching metadata filters

func (*Client) GetCollectionStats

func (c *Client) GetCollectionStats(ctx context.Context, collectionName string) (map[string]interface{}, error)

GetCollectionStats returns statistics about a collection

func (*Client) GetDocument

func (c *Client) GetDocument(ctx context.Context, collectionName, documentID string) (*Document, error)

GetDocument retrieves a specific document by ID

func (*Client) GetDocumentsByMetadata added in v0.0.4

func (c *Client) GetDocumentsByMetadata(ctx context.Context, collectionName string, metadataFilters []string) ([]Document, error)

GetDocumentsByMetadata gets documents matching metadata filters

func (*Client) Health

func (c *Client) Health(ctx context.Context) error

Health checks the health of the mock database

func (*Client) ListCollections

func (c *Client) ListCollections(ctx context.Context) ([]string, error)

ListCollections returns a list of all collections

func (*Client) ListDocuments

func (c *Client) ListDocuments(ctx context.Context, collectionName string, limit int) ([]Document, error)

ListDocuments returns a list of documents in a collection

func (*Client) Query added in v0.2.8

func (c *Client) Query(ctx context.Context, collectionName, queryText string, options weaviate.QueryOptions) ([]weaviate.QueryResult, error)

Query performs semantic search on a collection (mock implementation)

func (*Client) UpdateDocument added in v0.2.9

func (c *Client) UpdateDocument(ctx context.Context, collectionName, documentID, content string, metadata map[string]interface{}) error

UpdateDocument updates an existing document in the mock database

type Document

type Document struct {
	ID        string                 `json:"id"`
	Content   string                 `json:"content"`
	Image     string                 `json:"image"`
	ImageData string                 `json:"image_data"`
	URL       string                 `json:"url"`
	Metadata  map[string]interface{} `json:"metadata"`
}

Document represents a mock document

Jump to

Keyboard shortcuts

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