Update documentation and clients for v1.1.0
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled
Documentation updates: - Fix v0.1.0 → v1.1.0 version numbers in en, ru, fa, zh docs - Add missing Window Functions, Multi-Tenant ERP, Supported Keywords sections to ru, fa, zh baraql.md (~105 lines each) - Expand Turkish and Arabic baraql.md (110 → 268 lines) - Expand Turkish and Arabic installation.md (62 → 307 lines) - Add new Bulgarian documentation files (18 new files) Client updates: - Python: Full async/await rewrite with asyncio, request queueing - Rust: Full async/await rewrite with tokio, async examples - Nim: Update README to v1.1.0 - All clients now support async patterns consistently
This commit is contained in:
+42
-36
@@ -1,13 +1,13 @@
|
||||
# BaraDB Rust Client
|
||||
# BaraDB Async Rust Client
|
||||
|
||||
Official Rust client for **BaraDB** — a multimodal database engine written in Nim.
|
||||
Official async Rust client for **BaraDB** — a multimodal database engine written in Nim.
|
||||
|
||||
## Features
|
||||
|
||||
- **Binary wire protocol** — fast TCP communication using only `std`
|
||||
- **Zero dependencies** — no external crates required
|
||||
- **Sync API** — blocking I/O suitable for most applications
|
||||
- **Async/await** — fully non-blocking with Tokio runtime
|
||||
- **Binary wire protocol** — fast TCP communication
|
||||
- **Query builder** — fluent SQL construction
|
||||
- **Parameterized queries** — safe from SQL injection
|
||||
- **Vector & JSON support** — first-class multimodal types
|
||||
|
||||
## Installation
|
||||
@@ -16,13 +16,14 @@ Add to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
baradb = "1.0"
|
||||
baradb = "1.1"
|
||||
tokio = { version = "1.35", features = ["full"] }
|
||||
```
|
||||
|
||||
Or from source:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/barabadb/baradadb.git
|
||||
git clone https://github.com/katehonz/barabaDB.git
|
||||
cd clients/rust
|
||||
cargo build
|
||||
```
|
||||
@@ -32,13 +33,14 @@ cargo build
|
||||
```rust
|
||||
use baradb::Client;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut client = Client::connect("localhost", 9472)?;
|
||||
let result = client.query("SELECT name, age FROM users WHERE age > 18")?;
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
let mut client = Client::connect("localhost", 9472).await?;
|
||||
let result = client.query("SELECT name, age FROM users WHERE age > 18").await?;
|
||||
for row in result.rows() {
|
||||
println!("{:?}", row);
|
||||
}
|
||||
client.close();
|
||||
client.close().await;
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
@@ -48,16 +50,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
```rust
|
||||
use baradb::{Client, WireValue};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut client = Client::connect("localhost", 9472)?;
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
let mut client = Client::connect("localhost", 9472).await?;
|
||||
let result = client.query_params(
|
||||
"SELECT * FROM users WHERE age > $1 AND country = $2",
|
||||
&[WireValue::Int64(18), WireValue::String("BG".to_string())],
|
||||
)?;
|
||||
).await?;
|
||||
for row in result.rows() {
|
||||
println!("{:?}", row);
|
||||
}
|
||||
client.close();
|
||||
client.close().await;
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
@@ -65,21 +68,23 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
### Query Builder
|
||||
|
||||
```rust
|
||||
use baradb::Client;
|
||||
use baradb::{Client, QueryBuilder};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut client = Client::connect("localhost", 9472)?;
|
||||
let result = baradb::QueryBuilder::new(&mut client)
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
let mut client = Client::connect("localhost", 9472).await?;
|
||||
let result = QueryBuilder::new(&mut client)
|
||||
.select(&["name", "email"])
|
||||
.from("users")
|
||||
.where_clause("active = true")
|
||||
.order_by("name", "ASC")
|
||||
.limit(10)
|
||||
.exec()?;
|
||||
.exec()
|
||||
.await?;
|
||||
for row in result.rows() {
|
||||
println!("{:?}", row);
|
||||
}
|
||||
client.close();
|
||||
client.close().await;
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
@@ -89,13 +94,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
```rust
|
||||
use baradb::{Client, WireValue};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut client = Client::connect("localhost", 9472)?;
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
let mut client = Client::connect("localhost", 9472).await?;
|
||||
let result = client.query_params(
|
||||
"SELECT id, name FROM products ORDER BY embedding <-> $1 LIMIT 5",
|
||||
&[WireValue::Vector(vec![0.1, 0.2, 0.3])],
|
||||
)?;
|
||||
client.close();
|
||||
).await?;
|
||||
client.close().await;
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
@@ -112,7 +118,7 @@ Integration tests (requires server on `localhost:9472`):
|
||||
|
||||
```bash
|
||||
# Start server
|
||||
docker run -d -p 9472:9472 baradb:latest
|
||||
docker run -d -p 9472:9472 barabadb:latest
|
||||
|
||||
# Run all tests
|
||||
cargo test
|
||||
@@ -120,19 +126,19 @@ cargo test
|
||||
|
||||
## API Reference
|
||||
|
||||
### `Client::connect(host, port)`
|
||||
### `Client::connect(host, port) -> Result<Client>`
|
||||
|
||||
Creates a new client connected to the given host and port.
|
||||
Creates a new async client connected to the given host and port.
|
||||
|
||||
### Methods
|
||||
### Methods (all async)
|
||||
|
||||
- `query(sql) -> Result<QueryResult>` — execute SELECT-like query
|
||||
- `query_params(sql, params) -> Result<QueryResult>` — parameterized query
|
||||
- `execute(sql) -> Result<usize>` — execute DDL/DML, returns affected rows
|
||||
- `auth(token) -> Result<()>` — JWT authentication
|
||||
- `ping() -> Result<bool>` — health check
|
||||
- `close()` — close connection
|
||||
- `await client.query(sql) -> Result<QueryResult>` — execute SELECT-like query
|
||||
- `await client.query_params(sql, params) -> Result<QueryResult>` — parameterized query
|
||||
- `await client.execute(sql) -> Result<usize>` — execute DDL/DML, returns affected rows
|
||||
- `await client.auth(token) -> Result<()>` — JWT authentication
|
||||
- `await client.ping() -> Result<bool>` — health check
|
||||
- `await client.close()` — close connection
|
||||
|
||||
## License
|
||||
|
||||
Apache-2.0
|
||||
Apache-2.0
|
||||
Reference in New Issue
Block a user