Documentation
ΒΆ
Overview ΒΆ
Package ekodb provides a Go client for ekoDB
Package ekodb provides a Go client for ekoDB ΒΆ
Package ekodb provides a Go client for ekoDB ΒΆ
Package ekodb provides a Go client for ekoDB ΒΆ
Package ekodb provides a Go client for ekoDB ΒΆ
Package ekodb provides a Go client for ekoDB
Index ΒΆ
- func IntPtr(v int) *int
- func StringPtr(v string) *string
- type ChatMessage
- type ChatMessageRequest
- type ChatRequest
- type ChatResponse
- type ChatSession
- type ChatSessionResponse
- type Client
- func (c *Client) BatchDelete(collection string, ids []string) (int, error)
- func (c *Client) BatchInsert(collection string, records []Record) ([]Record, error)
- func (c *Client) BatchUpdate(collection string, updates map[string]Record) ([]Record, error)
- func (c *Client) BranchChatSession(request CreateChatSessionRequest) (*ChatResponse, error)
- func (c *Client) CallScript(labelOrID string, params map[string]interface{}) (*FunctionResult, error)
- func (c *Client) ChatMessage(sessionID string, request ChatMessageRequest) (*ChatResponse, error)
- func (c *Client) CreateChatSession(request CreateChatSessionRequest) (*ChatResponse, error)
- func (c *Client) CreateCollection(collection string, schema Schema) error
- func (c *Client) Delete(collection, id string) error
- func (c *Client) DeleteChatMessage(sessionID, messageID string) error
- func (c *Client) DeleteChatSession(sessionID string) error
- func (c *Client) DeleteCollection(collection string) error
- func (c *Client) DeleteScript(id string) error
- func (c *Client) Embed(text, model string) ([]float64, error)
- func (c *Client) Find(collection string, query interface{}) ([]Record, error)
- func (c *Client) FindAll(collection string, limit int) ([]Record, error)
- func (c *Client) FindByID(collection, id string) (Record, error)
- func (c *Client) GetChatSession(sessionID string) (*ChatSessionResponse, error)
- func (c *Client) GetChatSessionMessages(sessionID string, query *GetMessagesQuery) (*GetMessagesResponse, error)
- func (c *Client) GetCollection(collection string) (*CollectionMetadata, error)
- func (c *Client) GetRateLimitInfo() *RateLimitInfo
- func (c *Client) GetSchema(collection string) (*Schema, error)
- func (c *Client) GetScript(id string) (*Script, error)
- func (c *Client) Health() error
- func (c *Client) HybridSearch(collection, queryText string, queryVector []float64, limit int) ([]Record, error)
- func (c *Client) Insert(collection string, record Record, ttl ...string) (Record, error)
- func (c *Client) IsNearRateLimit() bool
- func (c *Client) KVDelete(key string) error
- func (c *Client) KVGet(key string) (interface{}, error)
- func (c *Client) KVSet(key string, value interface{}) error
- func (c *Client) ListChatSessions(query *ListSessionsQuery) (*ListSessionsResponse, error)
- func (c *Client) ListCollections() ([]string, error)
- func (c *Client) ListScripts(tags []string) ([]Script, error)
- func (c *Client) MergeChatSessions(request MergeSessionsRequest) (*ChatSessionResponse, error)
- func (c *Client) RegenerateChatMessage(sessionID, messageID string) (*ChatResponse, error)
- func (c *Client) SaveScript(script Script) (string, error)
- func (c *Client) Search(collection string, searchQuery SearchQuery) (*SearchResponse, error)
- func (c *Client) TextSearch(collection, queryText string, limit int) ([]Record, error)
- func (c *Client) ToggleForgottenMessage(sessionID, messageID string, forgotten bool) error
- func (c *Client) Update(collection, id string, record Record) (Record, error)
- func (c *Client) UpdateChatMessage(sessionID, messageID, content string) error
- func (c *Client) UpdateChatSession(sessionID string, request UpdateSessionRequest) (*ChatSessionResponse, error)
- func (c *Client) UpdateScript(id string, script Script) error
- func (c *Client) WebSocket(wsURL string) (*WebSocketClient, error)
- type ClientConfig
- type CollectionConfig
- type CollectionMetadata
- type CreateChatSessionRequest
- type DistanceMetric
- type FieldTypeSchema
- type FieldTypeSchemaBuilder
- func (fb *FieldTypeSchemaBuilder) BTreeIndex() *FieldTypeSchemaBuilder
- func (fb *FieldTypeSchemaBuilder) Build() FieldTypeSchema
- func (fb *FieldTypeSchemaBuilder) DefaultValue(value interface{}) *FieldTypeSchemaBuilder
- func (fb *FieldTypeSchemaBuilder) Enums(values []interface{}) *FieldTypeSchemaBuilder
- func (fb *FieldTypeSchemaBuilder) HashIndex() *FieldTypeSchemaBuilder
- func (fb *FieldTypeSchemaBuilder) Pattern(regex string) *FieldTypeSchemaBuilder
- func (fb *FieldTypeSchemaBuilder) Range(min, max interface{}) *FieldTypeSchemaBuilder
- func (fb *FieldTypeSchemaBuilder) Required() *FieldTypeSchemaBuilder
- func (fb *FieldTypeSchemaBuilder) TextIndex(language string) *FieldTypeSchemaBuilder
- func (fb *FieldTypeSchemaBuilder) Unique() *FieldTypeSchemaBuilder
- func (fb *FieldTypeSchemaBuilder) VectorIndex(algorithm VectorIndexAlgorithm, metric DistanceMetric, m, efConstruction int) *FieldTypeSchemaBuilder
- type FunctionResult
- type FunctionStageConfig
- func StageBatchDelete(collection string, ids []string, bypassRipple bool) FunctionStageConfig
- func StageBatchInsert(collection string, records []map[string]interface{}, bypassRipple bool) FunctionStageConfig
- func StageChat(messages []ChatMessage, model *string, temperature *float64) FunctionStageConfig
- func StageCount(outputField string) FunctionStageConfig
- func StageDelete(collection string, filter interface{}, bypassRipple bool) FunctionStageConfig
- func StageDeleteById(collection string, recordId string, bypassRipple bool) FunctionStageConfig
- func StageEmbed(texts interface{}, model *string) FunctionStageConfig
- func StageFindAll(collection string) FunctionStageConfig
- func StageGroup(by_fields []string, functions []GroupFunctionConfig) FunctionStageConfig
- func StageHttpRequest(url, method string, headers map[string]string, body interface{}) FunctionStageConfig
- func StageHybridSearch(collection string, queryText string, queryVector []float64, ...) FunctionStageConfig
- func StageInsert(collection string, record map[string]interface{}, bypassRipple bool, ...) FunctionStageConfig
- func StageProject(fields []string, exclude bool) FunctionStageConfig
- func StageQuery(collection string, filter interface{}, sort []SortFieldConfig, ...) FunctionStageConfig
- func StageTextSearch(collection string, queryText string, options map[string]interface{}) FunctionStageConfig
- func StageVectorSearch(collection string, queryVector []float64, limit *int, threshold *float64) FunctionStageConfig
- type FunctionStats
- type GetMessagesQuery
- type GetMessagesResponse
- type GroupFunctionConfig
- type GroupFunctionOp
- type IndexConfig
- type JoinConfig
- type ListSessionsQuery
- type ListSessionsResponse
- type MergeSessionsRequest
- type MergeStrategy
- type ParameterDefinition
- type Query
- type QueryBuilder
- func (qb *QueryBuilder) And(conditions []map[string]interface{}) *QueryBuilder
- func (qb *QueryBuilder) Build() map[string]interface{}
- func (qb *QueryBuilder) BuildJSON() ([]byte, error)
- func (qb *QueryBuilder) BypassCache(bypass bool) *QueryBuilder
- func (qb *QueryBuilder) BypassRipple(bypass bool) *QueryBuilder
- func (qb *QueryBuilder) Contains(field string, substring string) *QueryBuilder
- func (qb *QueryBuilder) EndsWith(field string, suffix string) *QueryBuilder
- func (qb *QueryBuilder) Eq(field string, value interface{}) *QueryBuilder
- func (qb *QueryBuilder) Gt(field string, value interface{}) *QueryBuilder
- func (qb *QueryBuilder) Gte(field string, value interface{}) *QueryBuilder
- func (qb *QueryBuilder) In(field string, values []interface{}) *QueryBuilder
- func (qb *QueryBuilder) Join(joinConfig map[string]interface{}) *QueryBuilder
- func (qb *QueryBuilder) Limit(limit int) *QueryBuilder
- func (qb *QueryBuilder) Lt(field string, value interface{}) *QueryBuilder
- func (qb *QueryBuilder) Lte(field string, value interface{}) *QueryBuilder
- func (qb *QueryBuilder) Ne(field string, value interface{}) *QueryBuilder
- func (qb *QueryBuilder) Nin(field string, values []interface{}) *QueryBuilder
- func (qb *QueryBuilder) Not(condition map[string]interface{}) *QueryBuilder
- func (qb *QueryBuilder) Or(conditions []map[string]interface{}) *QueryBuilder
- func (qb *QueryBuilder) Page(page, pageSize int) *QueryBuilder
- func (qb *QueryBuilder) Regex(field string, pattern string) *QueryBuilder
- func (qb *QueryBuilder) Skip(skip int) *QueryBuilder
- func (qb *QueryBuilder) SortAscending(field string) *QueryBuilder
- func (qb *QueryBuilder) SortDescending(field string) *QueryBuilder
- func (qb *QueryBuilder) StartsWith(field string, prefix string) *QueryBuilder
- type RateLimitError
- type RateLimitInfo
- type Record
- type Schema
- type SchemaBuilder
- type Script
- type SearchQuery
- type SearchQueryBuilder
- func (sb *SearchQueryBuilder) BoostExact(enabled bool) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) Build() SearchQuery
- func (sb *SearchQueryBuilder) BypassCache(bypass bool) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) BypassRipple(bypass bool) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) CaseSensitive(enabled bool) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) EnableStemming(enabled bool) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) Fields(fields string) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) Fuzzy(enabled bool) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) Language(language string) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) Limit(limit int) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) MaxEditDistance(distance int) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) MinScore(score float64) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) TextWeight(weight float64) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) Vector(vector []float64) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) VectorField(field string) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) VectorK(k int) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) VectorMetric(metric string) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) VectorThreshold(threshold float64) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) VectorWeight(weight float64) *SearchQueryBuilder
- func (sb *SearchQueryBuilder) Weights(weights string) *SearchQueryBuilder
- type SearchResponse
- type SearchResult
- type SerializationFormat
- type SortFieldConfig
- type SortOrder
- type StageStats
- type TokenUsage
- type UpdateSessionRequest
- type VectorIndexAlgorithm
- type WebSocketClient
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
Types ΒΆ
type ChatMessage ΒΆ added in v0.4.0
ChatMessage for AI operations
func NewChatMessage ΒΆ added in v0.4.0
func NewChatMessage(role, content string) ChatMessage
NewChatMessage creates a chat message
type ChatMessageRequest ΒΆ
type ChatMessageRequest struct {
Message string `json:"message"`
BypassRipple *bool `json:"bypass_ripple,omitempty"`
ForceSummarize *bool `json:"force_summarize,omitempty"`
}
ChatMessageRequest represents a request to send a message in an existing session
type ChatRequest ΒΆ
type ChatRequest struct {
Collections []CollectionConfig `json:"collections"`
LLMProvider string `json:"llm_provider"`
LLMModel *string `json:"llm_model,omitempty"`
Message string `json:"message"`
SystemPrompt *string `json:"system_prompt,omitempty"`
}
ChatRequest represents a request to send a chat message
type ChatResponse ΒΆ
type ChatResponse struct {
ChatID string `json:"chat_id"`
MessageID string `json:"message_id"`
Responses []string `json:"responses"`
ContextSnippets []interface{} `json:"context_snippets"`
ExecutionTimeMs int `json:"execution_time_ms"`
TokenUsage *TokenUsage `json:"token_usage,omitempty"`
}
ChatResponse represents a response from a chat operation
type ChatSession ΒΆ
type ChatSession struct {
ChatID string `json:"chat_id"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
LLMProvider string `json:"llm_provider"`
LLMModel string `json:"llm_model"`
Collections []CollectionConfig `json:"collections"`
SystemPrompt *string `json:"system_prompt,omitempty"`
Title *string `json:"title,omitempty"`
MessageCount int `json:"message_count"`
}
ChatSession represents a chat session
type ChatSessionResponse ΒΆ
type ChatSessionResponse struct {
Session Record `json:"session"`
MessageCount int `json:"message_count"`
}
ChatSessionResponse represents a response containing session details
type Client ΒΆ
type Client struct {
// contains filtered or unexported fields
}
Client represents an ekoDB client
func NewClient ΒΆ
NewClient creates a new ekoDB client (legacy signature for backward compatibility)
func NewClientWithConfig ΒΆ
func NewClientWithConfig(config ClientConfig) (*Client, error)
NewClientWithConfig creates a new ekoDB client with configuration
func (*Client) BatchDelete ΒΆ
BatchDelete deletes multiple documents
func (*Client) BatchInsert ΒΆ
BatchInsert inserts multiple documents
func (*Client) BatchUpdate ΒΆ
BatchUpdate updates multiple documents
func (*Client) BranchChatSession ΒΆ
func (c *Client) BranchChatSession(request CreateChatSessionRequest) (*ChatResponse, error)
BranchChatSession branches a chat session
func (*Client) CallScript ΒΆ added in v0.4.0
func (c *Client) CallScript(labelOrID string, params map[string]interface{}) (*FunctionResult, error)
CallScript executes a script by label or ID
func (*Client) ChatMessage ΒΆ
func (c *Client) ChatMessage(sessionID string, request ChatMessageRequest) (*ChatResponse, error)
ChatMessage sends a message in an existing chat session
func (*Client) CreateChatSession ΒΆ
func (c *Client) CreateChatSession(request CreateChatSessionRequest) (*ChatResponse, error)
CreateChatSession creates a new chat session
func (*Client) CreateCollection ΒΆ
CreateCollection creates a collection with schema
func (*Client) DeleteChatMessage ΒΆ
DeleteChatMessage deletes a specific message
func (*Client) DeleteChatSession ΒΆ
DeleteChatSession deletes a chat session
func (*Client) DeleteCollection ΒΆ
DeleteCollection deletes a collection
func (*Client) DeleteScript ΒΆ added in v0.4.0
DeleteScript deletes a script by ID
func (*Client) Embed ΒΆ added in v0.5.0
Embed generates embeddings for text using ekoDB's native Functions
This helper simplifies embedding generation by: 1. Creating a temporary collection with the text 2. Running a Script with FindAll + Embed Functions 3. Extracting and returning the embedding vector 4. Cleaning up temporary resources
Example:
embedding, err := client.Embed("Hello world", "text-embedding-3-small")
if err != nil {
log.Fatal(err)
}
fmt.Printf("Generated %d dimensions\n", len(embedding))
func (*Client) FindAll ΒΆ added in v0.5.0
FindAll finds all records in a collection with a limit
Simplified method to query all documents in a collection.
Example:
allMessages, err := client.FindAll("messages", 1000)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Found %d messages\n", len(allMessages))
func (*Client) GetChatSession ΒΆ
func (c *Client) GetChatSession(sessionID string) (*ChatSessionResponse, error)
GetChatSession gets a chat session by ID
func (*Client) GetChatSessionMessages ΒΆ
func (c *Client) GetChatSessionMessages(sessionID string, query *GetMessagesQuery) (*GetMessagesResponse, error)
GetChatSessionMessages gets messages from a chat session
func (*Client) GetCollection ΒΆ
func (c *Client) GetCollection(collection string) (*CollectionMetadata, error)
GetCollection gets collection metadata and schema
func (*Client) GetRateLimitInfo ΒΆ
func (c *Client) GetRateLimitInfo() *RateLimitInfo
GetRateLimitInfo returns the current rate limit information
func (*Client) HybridSearch ΒΆ added in v0.5.0
func (c *Client) HybridSearch(collection, queryText string, queryVector []float64, limit int) ([]Record, error)
HybridSearch performs hybrid search combining text and vector search
Combines semantic similarity (vector search) with keyword matching (text search) for more accurate and relevant results.
Example:
embedding, _ := client.Embed(query, "text-embedding-3-small")
results, err := client.HybridSearch("documents", query, embedding, 5)
if err != nil {
log.Fatal(err)
}
func (*Client) IsNearRateLimit ΒΆ
IsNearRateLimit checks if approaching rate limit
func (*Client) ListChatSessions ΒΆ
func (c *Client) ListChatSessions(query *ListSessionsQuery) (*ListSessionsResponse, error)
ListChatSessions lists all chat sessions
func (*Client) ListCollections ΒΆ
ListCollections lists all collections
func (*Client) ListScripts ΒΆ added in v0.4.0
ListScripts lists all scripts, optionally filtered by tags
func (*Client) MergeChatSessions ΒΆ
func (c *Client) MergeChatSessions(request MergeSessionsRequest) (*ChatSessionResponse, error)
MergeChatSessions merges multiple chat sessions into one
func (*Client) RegenerateChatMessage ΒΆ
func (c *Client) RegenerateChatMessage(sessionID, messageID string) (*ChatResponse, error)
RegenerateChatMessage regenerates an AI response message
func (*Client) SaveScript ΒΆ added in v0.4.0
SaveScript creates a new script
func (*Client) Search ΒΆ
func (c *Client) Search(collection string, searchQuery SearchQuery) (*SearchResponse, error)
Search performs a search query on a collection
func (*Client) TextSearch ΒΆ added in v0.5.0
TextSearch performs text search without embeddings
Simplified text search with full-text matching, fuzzy search, and stemming.
Example:
results, err := client.TextSearch("documents", "ownership system", 10)
if err != nil {
log.Fatal(err)
}
func (*Client) ToggleForgottenMessage ΒΆ
ToggleForgottenMessage toggles the "forgotten" status of a message
func (*Client) UpdateChatMessage ΒΆ
UpdateChatMessage updates a specific message
func (*Client) UpdateChatSession ΒΆ
func (c *Client) UpdateChatSession(sessionID string, request UpdateSessionRequest) (*ChatSessionResponse, error)
UpdateChatSession updates a chat session
func (*Client) UpdateScript ΒΆ added in v0.4.0
UpdateScript updates an existing script by ID
type ClientConfig ΒΆ
type ClientConfig struct {
BaseURL string // Base URL of the ekoDB server
APIKey string // API key for authentication
ShouldRetry bool // Enable automatic retries (default: true)
MaxRetries int // Maximum number of retry attempts (default: 3)
Timeout time.Duration // Request timeout (default: 30s)
Format SerializationFormat // Serialization format (default: MessagePack for best performance, use JSON for debugging)
}
ClientConfig contains configuration options for the client
type CollectionConfig ΒΆ
type CollectionConfig struct {
CollectionName string `json:"collection_name"`
Fields []interface{} `json:"fields"`
SearchOptions interface{} `json:"search_options,omitempty"`
}
CollectionConfig represents configuration for searching a specific collection
type CollectionMetadata ΒΆ
type CollectionMetadata struct {
Collection Schema `json:"collection"`
Analytics interface{} `json:"analytics,omitempty"`
}
CollectionMetadata represents collection metadata with analytics
type CreateChatSessionRequest ΒΆ
type CreateChatSessionRequest struct {
Collections []CollectionConfig `json:"collections"`
LLMProvider string `json:"llm_provider"`
LLMModel *string `json:"llm_model,omitempty"`
SystemPrompt *string `json:"system_prompt,omitempty"`
BypassRipple *bool `json:"bypass_ripple,omitempty"`
ParentID *string `json:"parent_id,omitempty"`
BranchPointIdx *int `json:"branch_point_idx,omitempty"`
MaxContextMessages *int `json:"max_context_messages,omitempty"`
}
CreateChatSessionRequest represents a request to create a new chat session
type DistanceMetric ΒΆ
type DistanceMetric string
DistanceMetric represents the distance metric for vector similarity
const ( // DistanceMetricCosine represents cosine similarity DistanceMetricCosine DistanceMetric = "cosine" // DistanceMetricEuclidean represents euclidean distance DistanceMetricEuclidean DistanceMetric = "euclidean" // DistanceMetricDotProduct represents dot product DistanceMetricDotProduct DistanceMetric = "dotproduct" )
type FieldTypeSchema ΒΆ
type FieldTypeSchema struct {
FieldType string `json:"field_type"`
Default interface{} `json:"default,omitempty"`
Unique bool `json:"unique,omitempty"`
Required bool `json:"required,omitempty"`
Enums []interface{} `json:"enums,omitempty"`
Max interface{} `json:"max,omitempty"`
Min interface{} `json:"min,omitempty"`
Regex *string `json:"regex,omitempty"`
Index *IndexConfig `json:"index,omitempty"`
}
FieldTypeSchema represents field type schema with constraints
type FieldTypeSchemaBuilder ΒΆ
type FieldTypeSchemaBuilder struct {
// contains filtered or unexported fields
}
FieldTypeSchemaBuilder provides a fluent API for building field type schemas
func NewFieldTypeSchemaBuilder ΒΆ
func NewFieldTypeSchemaBuilder(fieldType string) *FieldTypeSchemaBuilder
NewFieldTypeSchemaBuilder creates a new FieldTypeSchemaBuilder
func (*FieldTypeSchemaBuilder) BTreeIndex ΒΆ
func (fb *FieldTypeSchemaBuilder) BTreeIndex() *FieldTypeSchemaBuilder
BTreeIndex adds a B-tree index
func (*FieldTypeSchemaBuilder) Build ΒΆ
func (fb *FieldTypeSchemaBuilder) Build() FieldTypeSchema
Build builds the final FieldTypeSchema
func (*FieldTypeSchemaBuilder) DefaultValue ΒΆ
func (fb *FieldTypeSchemaBuilder) DefaultValue(value interface{}) *FieldTypeSchemaBuilder
DefaultValue sets a default value
func (*FieldTypeSchemaBuilder) Enums ΒΆ
func (fb *FieldTypeSchemaBuilder) Enums(values []interface{}) *FieldTypeSchemaBuilder
Enums sets enum values
func (*FieldTypeSchemaBuilder) HashIndex ΒΆ
func (fb *FieldTypeSchemaBuilder) HashIndex() *FieldTypeSchemaBuilder
HashIndex adds a hash index
func (*FieldTypeSchemaBuilder) Pattern ΒΆ
func (fb *FieldTypeSchemaBuilder) Pattern(regex string) *FieldTypeSchemaBuilder
Pattern sets regex pattern
func (*FieldTypeSchemaBuilder) Range ΒΆ
func (fb *FieldTypeSchemaBuilder) Range(min, max interface{}) *FieldTypeSchemaBuilder
Range sets min/max range
func (*FieldTypeSchemaBuilder) Required ΒΆ
func (fb *FieldTypeSchemaBuilder) Required() *FieldTypeSchemaBuilder
Required sets the field as required
func (*FieldTypeSchemaBuilder) TextIndex ΒΆ
func (fb *FieldTypeSchemaBuilder) TextIndex(language string) *FieldTypeSchemaBuilder
TextIndex adds a text index
func (*FieldTypeSchemaBuilder) Unique ΒΆ
func (fb *FieldTypeSchemaBuilder) Unique() *FieldTypeSchemaBuilder
Unique sets the field as unique
func (*FieldTypeSchemaBuilder) VectorIndex ΒΆ
func (fb *FieldTypeSchemaBuilder) VectorIndex(algorithm VectorIndexAlgorithm, metric DistanceMetric, m, efConstruction int) *FieldTypeSchemaBuilder
VectorIndex adds a vector index
type FunctionResult ΒΆ added in v0.4.0
type FunctionResult struct {
Records []map[string]interface{} `json:"records"`
Stats FunctionStats `json:"stats"`
}
FunctionResult from execution
type FunctionStageConfig ΒΆ added in v0.4.0
type FunctionStageConfig struct {
Stage string `json:"stage"`
Data map[string]interface{} `json:",inline"`
}
FunctionStageConfig represents a pipeline stage
func StageBatchDelete ΒΆ added in v0.4.0
func StageBatchDelete(collection string, ids []string, bypassRipple bool) FunctionStageConfig
func StageBatchInsert ΒΆ added in v0.4.0
func StageBatchInsert(collection string, records []map[string]interface{}, bypassRipple bool) FunctionStageConfig
StageBatchInsert inserts multiple records into a collection
func StageChat ΒΆ added in v0.4.0
func StageChat(messages []ChatMessage, model *string, temperature *float64) FunctionStageConfig
func StageCount ΒΆ added in v0.4.0
func StageCount(outputField string) FunctionStageConfig
func StageDelete ΒΆ added in v0.4.0
func StageDelete(collection string, filter interface{}, bypassRipple bool) FunctionStageConfig
StageDelete deletes records matching a filter (use StageDeleteById for ID-based deletion)
func StageDeleteById ΒΆ added in v0.4.0
func StageDeleteById(collection string, recordId string, bypassRipple bool) FunctionStageConfig
StageDeleteById deletes a specific record by ID
func StageEmbed ΒΆ added in v0.4.0
func StageEmbed(texts interface{}, model *string) FunctionStageConfig
func StageFindAll ΒΆ added in v0.4.0
func StageFindAll(collection string) FunctionStageConfig
Stage builders
func StageGroup ΒΆ added in v0.4.0
func StageGroup(by_fields []string, functions []GroupFunctionConfig) FunctionStageConfig
func StageHttpRequest ΒΆ added in v0.4.0
func StageHttpRequest(url, method string, headers map[string]string, body interface{}) FunctionStageConfig
func StageHybridSearch ΒΆ added in v0.4.0
func StageHybridSearch(collection string, queryText string, queryVector []float64, options map[string]interface{}) FunctionStageConfig
func StageInsert ΒΆ added in v0.4.0
func StageInsert(collection string, record map[string]interface{}, bypassRipple bool, ttl *int64) FunctionStageConfig
StageInsert inserts a single record into a collection
func StageProject ΒΆ added in v0.4.0
func StageProject(fields []string, exclude bool) FunctionStageConfig
StageProject selects or excludes specific fields from results exclude=false means include only these fields, exclude=true means exclude these fields
func StageQuery ΒΆ added in v0.4.0
func StageQuery(collection string, filter interface{}, sort []SortFieldConfig, limit, skip *int) FunctionStageConfig
StageQuery queries a collection with optional filter, sort, limit, skip
func StageTextSearch ΒΆ added in v0.4.0
func StageTextSearch(collection string, queryText string, options map[string]interface{}) FunctionStageConfig
func StageVectorSearch ΒΆ added in v0.4.0
func StageVectorSearch(collection string, queryVector []float64, limit *int, threshold *float64) FunctionStageConfig
StageVectorSearch performs vector similarity search
func (FunctionStageConfig) MarshalJSON ΒΆ added in v0.4.0
func (f FunctionStageConfig) MarshalJSON() ([]byte, error)
MarshalJSON custom marshaling for FunctionStageConfig
type FunctionStats ΒΆ added in v0.4.0
type FunctionStats struct {
InputCount int `json:"input_count"`
OutputCount int `json:"output_count"`
ExecutionTimeMs int64 `json:"execution_time_ms"`
StagesExecuted int `json:"stages_executed"`
StageStats []StageStats `json:"stage_stats"`
}
FunctionStats contains execution statistics
type GetMessagesQuery ΒΆ
type GetMessagesQuery struct {
Limit *int `json:"limit,omitempty"`
Skip *int `json:"skip,omitempty"`
Sort *string `json:"sort,omitempty"`
}
GetMessagesQuery represents query parameters for getting messages
type GetMessagesResponse ΒΆ
type GetMessagesResponse struct {
Messages []Record `json:"messages"`
Total int `json:"total"`
Skip int `json:"skip"`
Limit *int `json:"limit,omitempty"`
Returned int `json:"returned"`
}
GetMessagesResponse represents a response containing messages
type GroupFunctionConfig ΒΆ added in v0.4.0
type GroupFunctionConfig struct {
OutputField string `json:"output_field"`
Operation GroupFunctionOp `json:"operation"`
InputField *string `json:"input_field,omitempty"`
}
GroupFunctionConfig for Group stage
type GroupFunctionOp ΒΆ added in v0.4.0
type GroupFunctionOp string
const ( GroupFunctionSum GroupFunctionOp = "Sum" GroupFunctionAverage GroupFunctionOp = "Average" GroupFunctionCount GroupFunctionOp = "Count" GroupFunctionMin GroupFunctionOp = "Min" GroupFunctionMax GroupFunctionOp = "Max" GroupFunctionFirst GroupFunctionOp = "First" GroupFunctionLast GroupFunctionOp = "Last" GroupFunctionPush GroupFunctionOp = "Push" )
type IndexConfig ΒΆ
type IndexConfig struct {
Type string `json:"type"`
Language *string `json:"language,omitempty"`
Analyzer *string `json:"analyzer,omitempty"`
Algorithm *VectorIndexAlgorithm `json:"algorithm,omitempty"`
Metric *DistanceMetric `json:"metric,omitempty"`
M *int `json:"m,omitempty"`
EfConstruction *int `json:"ef_construction,omitempty"`
}
IndexConfig represents index configuration for a field
type JoinConfig ΒΆ
type JoinConfig struct {
Collections []string `json:"collections"`
LocalField string `json:"local_field"`
ForeignField string `json:"foreign_field"`
AsField string `json:"as_field"`
}
JoinConfig represents configuration for joining collections
func NewJoinConfig ΒΆ
func NewJoinConfig(collections []string, localField, foreignField, asField string) JoinConfig
NewJoinConfig creates a new join configuration
func NewSingleJoin ΒΆ
func NewSingleJoin(collection, localField, foreignField, asField string) JoinConfig
NewSingleJoin creates a join with a single collection
func (JoinConfig) ToMap ΒΆ
func (j JoinConfig) ToMap() map[string]interface{}
ToMap converts JoinConfig to a map for use in queries
type ListSessionsQuery ΒΆ
type ListSessionsQuery struct {
Limit *int `json:"limit,omitempty"`
Skip *int `json:"skip,omitempty"`
Sort *string `json:"sort,omitempty"`
}
ListSessionsQuery represents query parameters for listing sessions
type ListSessionsResponse ΒΆ
type ListSessionsResponse struct {
Sessions []ChatSession `json:"sessions"`
Total int `json:"total"`
Returned int `json:"returned"`
}
ListSessionsResponse represents a response containing list of sessions
type MergeSessionsRequest ΒΆ
type MergeSessionsRequest struct {
SourceChatIDs []string `json:"source_chat_ids"`
TargetChatID string `json:"target_chat_id"`
MergeStrategy MergeStrategy `json:"merge_strategy"`
}
MergeSessionsRequest represents a request to merge multiple chat sessions
type MergeStrategy ΒΆ
type MergeStrategy string
MergeStrategy represents how to merge chat sessions
const ( MergeStrategyChronological MergeStrategy = "Chronological" MergeStrategySummarized MergeStrategy = "Summarized" MergeStrategyLatestOnly MergeStrategy = "LatestOnly" )
type ParameterDefinition ΒΆ added in v0.4.0
type ParameterDefinition struct {
Required bool `json:"required"`
Default interface{} `json:"default,omitempty"`
Description string `json:"description,omitempty"`
}
ParameterDefinition for function parameters
type Query ΒΆ
type Query struct {
Limit *int `json:"limit,omitempty"`
Offset *int `json:"offset,omitempty"`
Filter map[string]interface{} `json:"filter,omitempty"`
}
Query represents a query for finding records
type QueryBuilder ΒΆ
type QueryBuilder struct {
// contains filtered or unexported fields
}
QueryBuilder provides a fluent API for building complex queries
func NewQueryBuilder ΒΆ
func NewQueryBuilder() *QueryBuilder
NewQueryBuilder creates a new QueryBuilder
func (*QueryBuilder) And ΒΆ
func (qb *QueryBuilder) And(conditions []map[string]interface{}) *QueryBuilder
And combines filters with AND logic
func (*QueryBuilder) Build ΒΆ
func (qb *QueryBuilder) Build() map[string]interface{}
Build builds the final query map
func (*QueryBuilder) BuildJSON ΒΆ
func (qb *QueryBuilder) BuildJSON() ([]byte, error)
BuildJSON builds the final query as JSON bytes
func (*QueryBuilder) BypassCache ΒΆ
func (qb *QueryBuilder) BypassCache(bypass bool) *QueryBuilder
BypassCache bypasses cache for this query
func (*QueryBuilder) BypassRipple ΒΆ
func (qb *QueryBuilder) BypassRipple(bypass bool) *QueryBuilder
BypassRipple bypasses ripple for this query
func (*QueryBuilder) Contains ΒΆ
func (qb *QueryBuilder) Contains(field string, substring string) *QueryBuilder
Contains adds a contains filter (substring match)
func (*QueryBuilder) EndsWith ΒΆ
func (qb *QueryBuilder) EndsWith(field string, suffix string) *QueryBuilder
EndsWith adds an ends-with filter
func (*QueryBuilder) Eq ΒΆ
func (qb *QueryBuilder) Eq(field string, value interface{}) *QueryBuilder
Eq adds an equality filter (Eq operator)
func (*QueryBuilder) Gt ΒΆ
func (qb *QueryBuilder) Gt(field string, value interface{}) *QueryBuilder
Gt adds a greater-than filter (Gt operator)
func (*QueryBuilder) Gte ΒΆ
func (qb *QueryBuilder) Gte(field string, value interface{}) *QueryBuilder
Gte adds a greater-than-or-equal filter (Gte operator)
func (*QueryBuilder) In ΒΆ
func (qb *QueryBuilder) In(field string, values []interface{}) *QueryBuilder
In adds an in-array filter (In operator)
func (*QueryBuilder) Join ΒΆ
func (qb *QueryBuilder) Join(joinConfig map[string]interface{}) *QueryBuilder
Join adds a join configuration
func (*QueryBuilder) Limit ΒΆ
func (qb *QueryBuilder) Limit(limit int) *QueryBuilder
Limit sets the maximum number of results
func (*QueryBuilder) Lt ΒΆ
func (qb *QueryBuilder) Lt(field string, value interface{}) *QueryBuilder
Lt adds a less-than filter (Lt operator)
func (*QueryBuilder) Lte ΒΆ
func (qb *QueryBuilder) Lte(field string, value interface{}) *QueryBuilder
Lte adds a less-than-or-equal filter (Lte operator)
func (*QueryBuilder) Ne ΒΆ
func (qb *QueryBuilder) Ne(field string, value interface{}) *QueryBuilder
Ne adds a not-equal filter (Ne operator)
func (*QueryBuilder) Nin ΒΆ
func (qb *QueryBuilder) Nin(field string, values []interface{}) *QueryBuilder
Nin adds a not-in-array filter (NotIn operator)
func (*QueryBuilder) Not ΒΆ
func (qb *QueryBuilder) Not(condition map[string]interface{}) *QueryBuilder
Not negates a filter
func (*QueryBuilder) Or ΒΆ
func (qb *QueryBuilder) Or(conditions []map[string]interface{}) *QueryBuilder
Or combines filters with OR logic
func (*QueryBuilder) Page ΒΆ
func (qb *QueryBuilder) Page(page, pageSize int) *QueryBuilder
Page sets page number and page size (convenience method)
func (*QueryBuilder) Regex ΒΆ added in v0.1.2
func (qb *QueryBuilder) Regex(field string, pattern string) *QueryBuilder
Regex adds a regex pattern match filter
func (*QueryBuilder) Skip ΒΆ
func (qb *QueryBuilder) Skip(skip int) *QueryBuilder
Skip sets the number of results to skip (for pagination)
func (*QueryBuilder) SortAscending ΒΆ
func (qb *QueryBuilder) SortAscending(field string) *QueryBuilder
SortAscending adds a sort field in ascending order
func (*QueryBuilder) SortDescending ΒΆ
func (qb *QueryBuilder) SortDescending(field string) *QueryBuilder
SortDescending adds a sort field in descending order
func (*QueryBuilder) StartsWith ΒΆ
func (qb *QueryBuilder) StartsWith(field string, prefix string) *QueryBuilder
StartsWith adds a starts-with filter
type RateLimitError ΒΆ
RateLimitError represents a rate limit error
func (*RateLimitError) Error ΒΆ
func (e *RateLimitError) Error() string
type RateLimitInfo ΒΆ
type RateLimitInfo struct {
Limit int // Maximum requests allowed per window
Remaining int // Requests remaining in current window
Reset int64 // Unix timestamp when the rate limit resets
}
RateLimitInfo contains rate limit information from the server
func (*RateLimitInfo) IsExceeded ΒΆ
func (r *RateLimitInfo) IsExceeded() bool
IsExceeded checks if the rate limit has been exceeded
func (*RateLimitInfo) IsNearLimit ΒΆ
func (r *RateLimitInfo) IsNearLimit() bool
IsNearLimit checks if approaching rate limit (less than 10% remaining)
func (*RateLimitInfo) RemainingPercentage ΒΆ
func (r *RateLimitInfo) RemainingPercentage() float64
RemainingPercentage returns the percentage of requests remaining
type Schema ΒΆ
type Schema struct {
Fields map[string]FieldTypeSchema `json:"fields"`
Version *int `json:"version,omitempty"`
CreatedAt *string `json:"created_at,omitempty"`
LastModified *string `json:"last_modified,omitempty"`
BypassRipple *bool `json:"bypass_ripple,omitempty"`
}
Schema represents a collection schema
type SchemaBuilder ΒΆ
type SchemaBuilder struct {
// contains filtered or unexported fields
}
SchemaBuilder provides a fluent API for building collection schemas
func NewSchemaBuilder ΒΆ
func NewSchemaBuilder() *SchemaBuilder
NewSchemaBuilder creates a new SchemaBuilder
func (*SchemaBuilder) AddField ΒΆ
func (sb *SchemaBuilder) AddField(name string, field FieldTypeSchema) *SchemaBuilder
AddField adds a field to the schema
func (*SchemaBuilder) Build ΒΆ
func (sb *SchemaBuilder) Build() Schema
Build builds the final Schema
func (*SchemaBuilder) BypassRipple ΒΆ
func (sb *SchemaBuilder) BypassRipple(bypass bool) *SchemaBuilder
BypassRipple sets bypass_ripple flag
func (*SchemaBuilder) Version ΒΆ
func (sb *SchemaBuilder) Version(version int) *SchemaBuilder
Version sets schema version
type Script ΒΆ added in v0.4.0
type Script struct {
Label string `json:"label"`
Name string `json:"name"`
Description *string `json:"description,omitempty"`
Version string `json:"version"`
Parameters map[string]ParameterDefinition `json:"parameters"`
Functions []FunctionStageConfig `json:"functions"`
Tags []string `json:"tags"`
ID *string `json:"id,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
Script represents a server-side data processing script
type SearchQuery ΒΆ
type SearchQuery struct {
Query string `json:"query"`
// Full-text search parameters
Language *string `json:"language,omitempty"`
CaseSensitive *bool `json:"case_sensitive,omitempty"`
Fuzzy *bool `json:"fuzzy,omitempty"`
MinScore *float64 `json:"min_score,omitempty"`
Fields *string `json:"fields,omitempty"`
Weights *string `json:"weights,omitempty"`
EnableStemming *bool `json:"enable_stemming,omitempty"`
BoostExact *bool `json:"boost_exact,omitempty"`
MaxEditDistance *int `json:"max_edit_distance,omitempty"`
// Vector search parameters
Vector []float64 `json:"vector,omitempty"`
VectorField *string `json:"vector_field,omitempty"`
VectorMetric *string `json:"vector_metric,omitempty"`
VectorK *int `json:"vector_k,omitempty"`
VectorThreshold *float64 `json:"vector_threshold,omitempty"`
// Hybrid search parameters
TextWeight *float64 `json:"text_weight,omitempty"`
VectorWeight *float64 `json:"vector_weight,omitempty"`
// Performance flags
BypassRipple *bool `json:"bypass_ripple,omitempty"`
BypassCache *bool `json:"bypass_cache,omitempty"`
Limit *int `json:"limit,omitempty"`
}
SearchQuery represents a search query for full-text and vector search
type SearchQueryBuilder ΒΆ
type SearchQueryBuilder struct {
// contains filtered or unexported fields
}
SearchQueryBuilder provides a fluent API for building search queries
func NewSearchQueryBuilder ΒΆ
func NewSearchQueryBuilder(queryString string) *SearchQueryBuilder
NewSearchQueryBuilder creates a new SearchQueryBuilder
func (*SearchQueryBuilder) BoostExact ΒΆ
func (sb *SearchQueryBuilder) BoostExact(enabled bool) *SearchQueryBuilder
BoostExact boosts exact matches
func (*SearchQueryBuilder) Build ΒΆ
func (sb *SearchQueryBuilder) Build() SearchQuery
Build builds the final SearchQuery
func (*SearchQueryBuilder) BypassCache ΒΆ
func (sb *SearchQueryBuilder) BypassCache(bypass bool) *SearchQueryBuilder
BypassCache bypasses cache
func (*SearchQueryBuilder) BypassRipple ΒΆ
func (sb *SearchQueryBuilder) BypassRipple(bypass bool) *SearchQueryBuilder
BypassRipple bypasses ripple cache
func (*SearchQueryBuilder) CaseSensitive ΒΆ
func (sb *SearchQueryBuilder) CaseSensitive(enabled bool) *SearchQueryBuilder
CaseSensitive enables case-sensitive search
func (*SearchQueryBuilder) EnableStemming ΒΆ
func (sb *SearchQueryBuilder) EnableStemming(enabled bool) *SearchQueryBuilder
EnableStemming enables stemming
func (*SearchQueryBuilder) Fields ΒΆ
func (sb *SearchQueryBuilder) Fields(fields string) *SearchQueryBuilder
Fields sets fields to search in (comma-separated)
func (*SearchQueryBuilder) Fuzzy ΒΆ
func (sb *SearchQueryBuilder) Fuzzy(enabled bool) *SearchQueryBuilder
Fuzzy enables fuzzy matching
func (*SearchQueryBuilder) Language ΒΆ
func (sb *SearchQueryBuilder) Language(language string) *SearchQueryBuilder
Language sets the language for stemming
func (*SearchQueryBuilder) Limit ΒΆ
func (sb *SearchQueryBuilder) Limit(limit int) *SearchQueryBuilder
Limit sets maximum number of results to return
func (*SearchQueryBuilder) MaxEditDistance ΒΆ
func (sb *SearchQueryBuilder) MaxEditDistance(distance int) *SearchQueryBuilder
MaxEditDistance sets maximum edit distance for fuzzy matching
func (*SearchQueryBuilder) MinScore ΒΆ
func (sb *SearchQueryBuilder) MinScore(score float64) *SearchQueryBuilder
MinScore sets minimum score threshold
func (*SearchQueryBuilder) TextWeight ΒΆ
func (sb *SearchQueryBuilder) TextWeight(weight float64) *SearchQueryBuilder
TextWeight sets text search weight for hybrid search
func (*SearchQueryBuilder) Vector ΒΆ
func (sb *SearchQueryBuilder) Vector(vector []float64) *SearchQueryBuilder
Vector sets query vector for semantic search
func (*SearchQueryBuilder) VectorField ΒΆ
func (sb *SearchQueryBuilder) VectorField(field string) *SearchQueryBuilder
VectorField sets vector field name
func (*SearchQueryBuilder) VectorK ΒΆ
func (sb *SearchQueryBuilder) VectorK(k int) *SearchQueryBuilder
VectorK sets number of vector results (k-nearest neighbors)
func (*SearchQueryBuilder) VectorMetric ΒΆ
func (sb *SearchQueryBuilder) VectorMetric(metric string) *SearchQueryBuilder
VectorMetric sets vector similarity metric
func (*SearchQueryBuilder) VectorThreshold ΒΆ
func (sb *SearchQueryBuilder) VectorThreshold(threshold float64) *SearchQueryBuilder
VectorThreshold sets minimum similarity threshold
func (*SearchQueryBuilder) VectorWeight ΒΆ
func (sb *SearchQueryBuilder) VectorWeight(weight float64) *SearchQueryBuilder
VectorWeight sets vector search weight for hybrid search
func (*SearchQueryBuilder) Weights ΒΆ
func (sb *SearchQueryBuilder) Weights(weights string) *SearchQueryBuilder
Weights sets field weights (format: "field1:2.0,field2:1.5")
type SearchResponse ΒΆ
type SearchResponse struct {
Results []SearchResult `json:"results"`
Total int `json:"total"`
TookMs *int `json:"took_ms,omitempty"`
}
SearchResponse represents the response from a search query
type SearchResult ΒΆ
type SearchResult struct {
Record map[string]interface{} `json:"record"`
Score float64 `json:"score"`
MatchedFields []string `json:"matched_fields"`
}
SearchResult represents a single search result
type SerializationFormat ΒΆ added in v0.2.0
type SerializationFormat int
SerializationFormat represents the serialization format for client-server communication
const ( // MessagePack format (binary, 2-3x faster) - DEFAULT for best performance MessagePack SerializationFormat = iota // JSON format (human-readable, opt-in for debugging) JSON )
type SortFieldConfig ΒΆ added in v0.4.0
SortFieldConfig for Sort stage
type StageStats ΒΆ added in v0.4.0
type StageStats struct {
Stage string `json:"stage"`
InputCount int `json:"input_count"`
OutputCount int `json:"output_count"`
ExecutionTimeMs int64 `json:"execution_time_ms"`
}
StageStats contains statistics for a single stage
type TokenUsage ΒΆ
type TokenUsage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
}
TokenUsage represents token usage statistics
type UpdateSessionRequest ΒΆ
type UpdateSessionRequest struct {
SystemPrompt *string `json:"system_prompt,omitempty"`
LLMModel *string `json:"llm_model,omitempty"`
Collections []CollectionConfig `json:"collections,omitempty"`
Title *string `json:"title,omitempty"`
}
UpdateSessionRequest represents a request to update session metadata
type VectorIndexAlgorithm ΒΆ
type VectorIndexAlgorithm string
VectorIndexAlgorithm represents the vector index algorithm
const ( // VectorIndexFlat represents simple flat index (brute force) VectorIndexFlat VectorIndexAlgorithm = "flat" // VectorIndexHNSW represents Hierarchical Navigable Small World VectorIndexHNSW VectorIndexAlgorithm = "hnsw" // VectorIndexIVF represents Inverted File Index VectorIndexIVF VectorIndexAlgorithm = "ivf" )
type WebSocketClient ΒΆ
type WebSocketClient struct {
// contains filtered or unexported fields
}
WebSocketClient represents a WebSocket connection to ekoDB
func (*WebSocketClient) Close ΒΆ
func (ws *WebSocketClient) Close() error
Close closes the WebSocket connection