e1bae0c7a0
- Add docs/ folder with English (en/) and Bulgarian (bg/) documentation - Create index.md with language switching and links - English docs: installation, quickstart, architecture, baraql, storage, schema, lsm, btree, vector, graph, fts, columnar, transactions, distributed, protocol, udf, api-binary, api-http, api-websocket - Bulgarian docs: installation, quickstart, architecture, baraql, schema, lsm, btree, vector, graph, fts, transactions, distributed - Update README license to BSD 3-Clause - Add LICENSE file with BSD 3-Clause text
2.0 KiB
2.0 KiB
BaraDB - Quick Start Guide
Starting the Server
After building BaraDB, start the server:
./build/baradadb
The server will start on localhost:8080 by default.
Connecting via CLI
BaraDB includes an interactive shell:
./build/baradadb --shell
Basic Operations
Create Schema
CREATE TYPE Person {
name: str,
age: int32
};
CREATE TYPE Movie {
title: str,
year: int32,
director: Person
};
Insert Data
INSERT Person { name := 'Alice', age := 30 };
INSERT Person { name := 'Bob', age := 25 };
Query Data
SELECT name, age FROM Person WHERE age > 18;
Update Data
UPDATE Person SET age = 31 WHERE name = 'Alice';
Delete Data
DELETE FROM Person WHERE name = 'Bob';
Advanced Queries
JOIN
SELECT u.name, o.total
FROM users u
INNER JOIN orders o ON u.id = o.user_id;
Aggregates
SELECT department, count(*), avg(salary)
FROM employees
GROUP BY department
HAVING count(*) > 5;
CTEs
WITH active_users AS (
SELECT * FROM users WHERE active = true
)
SELECT * FROM active_users;
Vector Search
-- Insert vector
INSERT vectors { id := 1, embedding := [0.1, 0.2, 0.3] };
-- Search similar
SELECT * FROM vectors ORDER BY cosine_distance(embedding, [0.1, 0.2, 0.3]) LIMIT 10;
Graph Operations
-- Match graph pattern
MATCH (p:Person)-[:KNOWS]->(other:Person)
WHERE p.name = 'Alice'
RETURN other.name;
Full-Text Search
-- Search documents
SELECT * FROM articles WHERE MATCH(title, body) AGAINST('database');
HTTP/REST API
# GET request
curl http://localhost:8080/api/users
# POST request
curl -X POST http://localhost:8080/api/users \
-H "Content-Type: application/json" \
-d '{"name": "Alice", "age": 30}'