Expand description
§ekoDB Client Library
Official Rust client for ekoDB - A high-performance database with intelligent caching, real-time capabilities, and automatic optimization.
§Features
- Async/Await: Built on Tokio for high-performance async operations
- Type-Safe: Strong typing with Rust’s type system
- Auto-Retry: Automatic retry with exponential backoff for transient failures
- Connection Pooling: Efficient connection management
- WebSocket Support: Real-time subscriptions and updates
- Batch Operations: Efficient bulk inserts, updates, and deletes
- Query Builder: Fluent API for building complex queries
§Quick Start
use ekodb_client::{Client, Record};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client
let client = Client::builder()
.base_url("https://api.ekodb.net")
.api_key("your-api-key")
.build()?;
// Insert a record
let mut record = Record::new();
record.insert("name", "John Doe");
record.insert("age", 30);
let result = client.insert("users", record, None).await?;
println!("Inserted: {:?}", result);
Ok(())
}Structs§
- Batch
Builder - Builder for batch operations
- Chat
Message - Chat message for AI operations
- Chat
Message Request - Request to send a message in an existing session
- Chat
Request - Request to send a chat message
- Chat
Response - Response from a chat request
- Chat
Session - Chat session details
- Chat
Session Response - Response containing chat session information
- Chat
Text Search Options - Text search options for chat context retrieval
- Client
- ekoDB client
- Client
Builder - Builder for creating a Client
- Collection
Config - Configuration for searching a specific collection
- Collection
Metadata - Collection metadata with analytics
- Context
Snippet - Context snippet from search results
- Create
Chat Session Request - Request to create a new chat session
- Field
Search Options - Field-specific search options
- Field
Type Schema - Field type schema with constraints
- Function
Result - Function execution result
- Function
Stats - Statistics about function execution
- GetMessages
Query - Query parameters for getting messages
- GetMessages
Response - Response containing messages with pagination metadata
- Group
Function Config - Group function configuration for Group stage
- Join
Config - Configuration for joining collections
- List
Sessions Query - Query parameters for listing sessions
- List
Sessions Response - Response containing list of chat sessions
- Merge
Sessions Request - Request to merge multiple chat sessions
- Models
- Available LLM models from different providers
- Parameter
Definition - Parameter definition for a function
- Query
- Query for finding records
- Query
Builder - Builder for constructing complex queries
- Rate
Limit Info - Rate limit information from the server
- Record
- A record in ekoDB
- Schema
- Collection schema
- Script
- A Script definition with Functions and parameters
- Search
Query - Search query for full-text and vector search
- Search
Response - Search response containing results and metadata
- Search
Result - Search result with score and matched fields
- Sort
Field Config - Sort field configuration
- Stage
Stats - Statistics for a single stage
- Toggle
Forgotten Request - Request to toggle message forgotten status
- Token
Usage - Token usage information from LLM providers
- Update
Message Request - Request to update a message
- Update
Session Request - Request to update session metadata
- User
Function - A UserFunction is a reusable sequence of Functions that can be called by Scripts
- WebSocket
Client - WebSocket client for real-time communication with persistent connection
Enums§
- Distance
Metric - Distance metric for vector similarity
- Error
- Errors that can occur when using the ekoDB client
- Field
Type - Field type representing all supported data types in ekoDB
- Function
- Function in a Script
- Group
Function Op - Group function operation type
- Index
Config - Index configuration for a field
- Merge
Strategy - Merge strategy for combining chat sessions
- Number
Value - Flexible numeric value that can be Integer, Float, or Decimal
- Query
Operator - Query operators for filtering
- Script
Condition - Condition evaluation for Script control flow (If statements)
- Serialization
Format - Serialization format for client-server communication
- Sort
Order - Sort order for query results
- Vector
Index Algorithm - Vector index algorithm
Constants§
- VERSION
- Client version
Functions§
- extract_
record - Transform an entire record by extracting all field values. Preserves the ‘id’ field and extracts values from all other fields.
- get_
array_ value - Extract an array from an ekoDB Array field
- get_
binary_ value - Extract bytes from an ekoDB Binary field
- get_
bool_ value - Extract a boolean value from an ekoDB field
- get_
bytes_ value - Extract bytes from an ekoDB Bytes field
- get_
datetime_ value - Extract a DateTime string from an ekoDB DateTime field
- get_
decimal_ value - Extract a decimal value from an ekoDB Decimal field
- get_
duration_ value - Extract duration in milliseconds from an ekoDB Duration field
- get_
float_ value - Extract a float value from an ekoDB field
- get_
int_ value - Extract an integer value from an ekoDB field
- get_
object_ value - Extract an object from an ekoDB Object field
- get_
set_ value - Extract an array from an ekoDB Set field
- get_
string_ value - Extract a string value from an ekoDB field
- get_
uuid_ value - Extract a UUID string from an ekoDB UUID field
- get_
value - Extract the value from an ekoDB field object.
ekoDB returns fields as
{"type": "String", "value": "..."}objects. This helper safely extracts the value or returns the input if it’s not a field object. - get_
values - Extract values from multiple fields in a record. Useful for processing entire records returned from ekoDB.
- get_
vector_ value - Extract a vector of floats from an ekoDB Vector field
Type Aliases§
- Result
- Result type alias for ekoDB client operations