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:
+164
-5
@@ -98,13 +98,172 @@ RETURN friend.name;
|
||||
```sql
|
||||
BEGIN;
|
||||
INSERT users { name := 'Alice', age := 30 };
|
||||
INSERT orders { user_id := last_insert_id(), total := 100 };
|
||||
COMMIT;
|
||||
|
||||
-- Savepoint ile
|
||||
BEGIN;
|
||||
INSERT users { name := 'Bob', age := 25 };
|
||||
SAVEPOINT sp1;
|
||||
INSERT orders { user_id := last_insert_id(), total := 200 };
|
||||
-- Hata, savepoint'e geri al
|
||||
ROLLBACK TO sp1;
|
||||
COMMIT;
|
||||
```
|
||||
|
||||
## Grafik Kalıpları
|
||||
## Tam Metin Arama
|
||||
|
||||
```sql
|
||||
MATCH (p:Person)-[:KNOWS]->(friend:Person)
|
||||
WHERE p.name = 'Alice'
|
||||
RETURN friend.name;
|
||||
```
|
||||
-- Temel arama
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH(title, body) AGAINST('database programming');
|
||||
|
||||
-- İlgi puanı ile
|
||||
SELECT title, relevance()
|
||||
FROM articles
|
||||
WHERE MATCH(title, body) AGAINST('Nim language')
|
||||
ORDER BY relevance() DESC;
|
||||
|
||||
-- Boolean modu
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH(title, body) AGAINST('+Nim -Python' IN BOOLEAN MODE);
|
||||
|
||||
-- Fuzzy arama
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH(title) AGAINST('programing' WITH FUZZINESS 2);
|
||||
```
|
||||
|
||||
## Kullanıcı Tanımlı Fonksiyonlar
|
||||
|
||||
```sql
|
||||
-- UDF kaydet
|
||||
CREATE FUNCTION greet(name str) -> str {
|
||||
RETURN 'Hello, ' || name || '!';
|
||||
};
|
||||
|
||||
-- Kullan
|
||||
SELECT greet(name) FROM users;
|
||||
|
||||
-- Dahili fonksiyonlar
|
||||
SELECT abs(-5), sqrt(16), lower('HELLO'), len('test');
|
||||
```
|
||||
|
||||
## Sorgu İpuçları
|
||||
|
||||
```sql
|
||||
-- İndeks kullanımını zorla
|
||||
SELECT /*+ USE_INDEX(idx_users_age) */ * FROM users WHERE age > 18;
|
||||
|
||||
-- Approximate vektör araması zorla
|
||||
SELECT /*+ APPROXIMATE */ * FROM vectors
|
||||
ORDER BY cosine_distance(embedding, [...])
|
||||
LIMIT 10;
|
||||
|
||||
-- Paralel çalıştırma
|
||||
SELECT /*+ PARALLEL(4) */ * FROM large_table;
|
||||
```
|
||||
|
||||
## Pencere Fonksiyonları
|
||||
|
||||
```sql
|
||||
-- Sıralama fonksiyonları
|
||||
SELECT
|
||||
name,
|
||||
department,
|
||||
ROW_NUMBER() OVER (PARTITION BY department ORDER BY salary DESC) AS rn,
|
||||
RANK() OVER (PARTITION BY department ORDER BY salary DESC) AS r,
|
||||
DENSE_RANK() OVER (PARTITION BY department ORDER BY salary DESC) AS dr
|
||||
FROM employees;
|
||||
|
||||
-- Değer fonksiyonları
|
||||
SELECT
|
||||
name,
|
||||
salary,
|
||||
LAG(salary, 1, 0) OVER (ORDER BY salary) AS prev_salary,
|
||||
LEAD(salary, 1, 0) OVER (ORDER BY salary) AS next_salary,
|
||||
FIRST_VALUE(name) OVER (PARTITION BY department ORDER BY salary) AS cheapest,
|
||||
LAST_VALUE(name) OVER (PARTITION BY department ORDER BY salary) AS most_expensive
|
||||
FROM employees;
|
||||
|
||||
-- Dağılım fonksiyonları
|
||||
SELECT name, NTILE(4) OVER (ORDER BY salary) AS quartile FROM employees;
|
||||
```
|
||||
|
||||
### Çerçeve Spesifikasyonları
|
||||
|
||||
```sql
|
||||
-- ROWS çerçevesi
|
||||
SUM(salary) OVER (
|
||||
PARTITION BY department
|
||||
ORDER BY hire_date
|
||||
ROWS BETWEEN 1 PRECEDING AND CURRENT ROW
|
||||
)
|
||||
|
||||
-- RANGE çerçevesi
|
||||
SUM(salary) OVER (
|
||||
PARTITION BY department
|
||||
ORDER BY hire_date
|
||||
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
|
||||
)
|
||||
```
|
||||
|
||||
## Çok Kiracılı ERP
|
||||
|
||||
BaraDB, **Satır Düzeyinde Güvenlik (RLS)** ve **oturum değişkenlerini** birleştirerek tek bir veritabanı örneğinde birden fazla şirketi (kiracı) çalıştırmayı destekler.
|
||||
|
||||
### Oturum Değişkenleri
|
||||
|
||||
```sql
|
||||
SET app.tenant_id = 'company-123';
|
||||
SELECT current_setting('app.tenant_id') AS tenant;
|
||||
```
|
||||
|
||||
### Mevcut Kullanıcı / Rol
|
||||
|
||||
```sql
|
||||
SELECT current_user AS me, current_role AS my_role;
|
||||
```
|
||||
|
||||
### RLS Kiracı İzolasyonu
|
||||
|
||||
```sql
|
||||
-- Tabloda RLS etkinleştir
|
||||
ALTER TABLE invoices ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
-- Kiracıya göre filtreleme ilkesi oluştur
|
||||
CREATE POLICY tenant_isolation ON invoices
|
||||
FOR SELECT USING (tenant_id = current_setting('app.tenant_id'));
|
||||
|
||||
-- Her oturum yalnızca kendi verilerini görür
|
||||
SET app.tenant_id = 'company-a';
|
||||
SELECT * FROM invoices; -- yalnızca company-a satırları
|
||||
```
|
||||
|
||||
### Neden Çok Kiracılı?
|
||||
|
||||
- **Bir örnek, çok kiracı** — 100 ayrı veritabanı çalıştırmaya gerek yok
|
||||
- **JSONB belgeleri** — Esnek şema depolama, her kiracı için kolayca alan ekleme
|
||||
- **RLS izolasyonu garanti eder** — Veritabanı kiracı sınırlarını uygular, yalnızca uygulama değil
|
||||
|
||||
## Desteklenen Anahtar Kelimeler
|
||||
|
||||
| Kategori | Anahtar Kelimeler |
|
||||
|----------|----------|
|
||||
| DQL | SELECT, FROM, WHERE, ORDER BY, GROUP BY, HAVING, LIMIT, OFFSET, DISTINCT |
|
||||
| DML | INSERT, UPDATE, DELETE, SET, VALUES |
|
||||
| DDL | CREATE TYPE, DROP TYPE, CREATE INDEX, DROP INDEX, ALTER TYPE |
|
||||
| Join | INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, CROSS JOIN, ON |
|
||||
| Set | UNION, UNION ALL, INTERSECT, EXCEPT |
|
||||
| CTEs | WITH, RECURSIVE, AS |
|
||||
| Case | CASE, WHEN, THEN, ELSE, END |
|
||||
| Transaction | BEGIN, COMMIT, ROLLBACK, SAVEPOINT |
|
||||
| Graph | MATCH, RETURN, WHERE, shortestPath, type |
|
||||
| FTS | MATCH, AGAINST, relevance, IN BOOLEAN MODE, WITH FUZZINESS |
|
||||
| Vector | cosine_distance, euclidean_distance, inner_product, l1_distance, l2_distance, <-> |
|
||||
| JSON | ->, ->> |
|
||||
| FTS | @@ (BM25 eşleşme) |
|
||||
| Recovery | RECOVER TO TIMESTAMP |
|
||||
| Functions | count, sum, avg, min, max, stddev, variance, abs, sqrt, lower, upper, len, trim, substr, now, last_insert_id, current_setting |
|
||||
| Session | SET, current_setting, current_user, current_role |
|
||||
| Window | OVER, PARTITION BY, ROWS, RANGE, UNBOUNDED PRECEDING, CURRENT ROW, FOLLOWING |
|
||||
| Window Functions | ROW_NUMBER, RANK, DENSE_RANK, LEAD, LAG, FIRST_VALUE, LAST_VALUE, NTILE |
|
||||
@@ -22,38 +22,284 @@
|
||||
### Linux
|
||||
|
||||
```bash
|
||||
# Resmi kurulum scripti
|
||||
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
|
||||
|
||||
# Ubuntu/Debian
|
||||
sudo apt-get update
|
||||
sudo apt-get install nim
|
||||
|
||||
# Fedora
|
||||
sudo dnf install nim
|
||||
|
||||
# Arch Linux
|
||||
sudo pacman -S nim
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
||||
```bash
|
||||
# Homebrew
|
||||
brew install nim
|
||||
|
||||
# MacPorts
|
||||
sudo port install nim
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
```powershell
|
||||
# choosenim ile
|
||||
curl.exe -A "MSYS2_$(uname -m)" -L https://nim-lang.org/choosenim/init.ps1 | powershell -
|
||||
|
||||
# winget ile
|
||||
winget install nim
|
||||
|
||||
# scoop ile
|
||||
scoop install nim
|
||||
```
|
||||
|
||||
### Kurulumu Doğrulama
|
||||
|
||||
```bash
|
||||
nim --version
|
||||
# Beklenen: Nim Compiler Version 2.2.0 veya daha yeni
|
||||
```
|
||||
|
||||
## OpenSSL Kurulumu
|
||||
|
||||
### Linux
|
||||
|
||||
```bash
|
||||
# Ubuntu/Debian
|
||||
sudo apt-get install libssl-dev
|
||||
|
||||
# Fedora
|
||||
sudo dnf install openssl-devel
|
||||
|
||||
# Arch Linux
|
||||
sudo pacman -S openssl
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
||||
OpenSSL sistemle birlikte gelir. Gerekirse:
|
||||
|
||||
```bash
|
||||
brew install openssl
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
OpenSSL, Nim Windows dağıtımıyla birlikte gelir. Manuel derlemeler için [slproweb.com](https://slproweb.com/products/Win32OpenSSL.html) adresinden indirin.
|
||||
|
||||
## BaraDB Derleme
|
||||
|
||||
### Depoyu Klonlama
|
||||
|
||||
```bash
|
||||
git clone https://github.com/katehonz/barabaDB.git
|
||||
cd barabaDB
|
||||
```
|
||||
|
||||
### Bağımlılıkları Kurma
|
||||
|
||||
```bash
|
||||
nimble install -d -y
|
||||
```
|
||||
|
||||
### Derleme Seçenekleri
|
||||
|
||||
#### Debug Derleme
|
||||
|
||||
```bash
|
||||
nim c -d:ssl -o:build/baradadb src/baradadb.nim
|
||||
```
|
||||
|
||||
#### Release Derleme (Önerilen)
|
||||
|
||||
```bash
|
||||
nim c -d:ssl -d:release --opt:speed -o:build/baradadb src/baradadb.nim
|
||||
```
|
||||
|
||||
#### Nimble Tasks Kullanma
|
||||
|
||||
```bash
|
||||
# Debug derleme
|
||||
nimble build_debug
|
||||
|
||||
# Release derleme
|
||||
nimble build_release
|
||||
```
|
||||
|
||||
#### Binary Boyutunu Küçültme
|
||||
|
||||
```bash
|
||||
nim c -d:ssl -d:release --opt:size -o:build/baradadb src/baradadb.nim
|
||||
strip build/baradadb
|
||||
```
|
||||
|
||||
### Derlemeyi Doğrulama
|
||||
|
||||
```bash
|
||||
./build/baradadb --version
|
||||
# Beklenen: BaraDB v1.1.0 — Multimodal Database Engine
|
||||
```
|
||||
|
||||
## Testleri Çalıştırma
|
||||
|
||||
### Tüm Testler
|
||||
|
||||
```bash
|
||||
nim c -d:ssl -r tests/test_all.nim
|
||||
```
|
||||
|
||||
### Belirli Test Süitleri
|
||||
|
||||
```bash
|
||||
# Depolama testleri
|
||||
nim c -d:ssl -r tests/test_storage.nim
|
||||
|
||||
# Sorgu motoru testleri
|
||||
nim c -d:ssl -r tests/test_query.nim
|
||||
|
||||
# Protokol testleri
|
||||
nim c -d:ssl -r tests/test_protocol.nim
|
||||
```
|
||||
|
||||
### Benchmarklar
|
||||
|
||||
```bash
|
||||
nim c -d:ssl -d:release -r benchmarks/bench_all.nim
|
||||
```
|
||||
|
||||
## Kurulum Seçenekleri
|
||||
|
||||
### Sistem Geneli Kurulum
|
||||
|
||||
```bash
|
||||
# Release binary derle
|
||||
nimble build_release
|
||||
|
||||
# /usr/local/bin'e kur
|
||||
sudo cp build/baradadb /usr/local/bin/
|
||||
sudo chmod +x /usr/local/bin/baradadb
|
||||
|
||||
# Veri dizini oluştur
|
||||
sudo mkdir -p /var/lib/baradb
|
||||
sudo chmod 755 /var/lib/baradb
|
||||
```
|
||||
|
||||
### Ön Derlenmiş Binary
|
||||
|
||||
En son sürümü platformunuz için indirin:
|
||||
|
||||
```bash
|
||||
# Linux x86_64
|
||||
wget https://github.com/katehonz/barabaDB/releases/latest/download/baradadb-linux-amd64
|
||||
chmod +x baradadb-linux-amd64
|
||||
mv baradadb-linux-amd64 /usr/local/bin/baradadb
|
||||
|
||||
# Linux ARM64
|
||||
wget https://github.com/katehonz/barabaDB/releases/latest/download/baradadb-linux-arm64
|
||||
chmod +x baradadb-linux-arm64
|
||||
mv baradadb-linux-arm64 /usr/local/bin/baradadb
|
||||
|
||||
# macOS
|
||||
wget https://github.com/katehonz/barabaDB/releases/latest/download/baradadb-darwin-amd64
|
||||
chmod +x baradadb-darwin-amd64
|
||||
mv baradadb-darwin-amd64 /usr/local/bin/baradadb
|
||||
```
|
||||
|
||||
### Docker
|
||||
|
||||
```bash
|
||||
# Resmi image'i çek
|
||||
docker pull barabadb/barabadb:latest
|
||||
|
||||
# Çalıştır
|
||||
docker run -d \
|
||||
-p 9472:9472 \
|
||||
-p 9470:9470 \
|
||||
-p 9471:9471 \
|
||||
-v baradb_data:/data \
|
||||
barabadb/barabadb
|
||||
```
|
||||
|
||||
### Docker Compose
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Gömülü Kullanım (Nim Projeleri)
|
||||
|
||||
`.nimble` dosyanıza ekleyin:
|
||||
|
||||
```nim
|
||||
requires "barabadb >= 1.1.0"
|
||||
```
|
||||
|
||||
Kodunuzda kullanın:
|
||||
|
||||
```nim
|
||||
import barabadb/storage/lsm
|
||||
|
||||
var db = newLSMTree("./data")
|
||||
db.put("key", cast[seq[byte]]("value"))
|
||||
let (found, val) = db.get("key")
|
||||
db.close()
|
||||
```
|
||||
|
||||
## İlk Çalıştırma
|
||||
|
||||
```bash
|
||||
# Sunucuyu başlat
|
||||
./build/baradadb
|
||||
|
||||
# Beklenen çıktı:
|
||||
# BaraDB v1.1.0 — Multimodal Database Engine
|
||||
# BaraDB TCP listening on 127.0.0.1:9472
|
||||
|
||||
# HTTP API ile test et
|
||||
curl http://localhost:9470/health
|
||||
|
||||
# İnteraktif shell
|
||||
./build/baradadb --shell
|
||||
```
|
||||
|
||||
## Kurulum Sorunlarını Giderme
|
||||
|
||||
### "cannot open file: hunos"
|
||||
|
||||
```bash
|
||||
nimble install -d -y
|
||||
```
|
||||
|
||||
### "BaraDB requires SSL support"
|
||||
|
||||
Her zaman `-d:ssl` ile derleyin:
|
||||
|
||||
```bash
|
||||
nim c -d:ssl -o:build/baradadb src/baradadb.nim
|
||||
```
|
||||
|
||||
### Yavaş derleme
|
||||
|
||||
Paralel derleme kullanın:
|
||||
|
||||
```bash
|
||||
nim c -d:ssl -d:release --parallelBuild:4 -o:build/baradadb src/baradadb.nim
|
||||
```
|
||||
|
||||
### Büyük binary boyutu
|
||||
|
||||
Boyut optimizasyonu kullanın:
|
||||
|
||||
```bash
|
||||
nim c -d:ssl -d:release --opt:size --passL:-s -o:build/baradadb src/baradadb.nim
|
||||
```
|
||||
|
||||
## Sonraki Adımlar
|
||||
|
||||
- [Hızlı Başlangıç](quickstart.md)
|
||||
|
||||
Reference in New Issue
Block a user