feat: JSON/JSONB validation, multi-column indexes, CTE execution, wire protocol column types

- Add fkJson to wire protocol with serialization/deserialization
- Validate JSON/JSONB on INSERT/UPDATE via std/json
- Send real column type metadata in wire protocol responses
- Update all 4 clients (Nim, Python, JS, Rust) for JSON and columnTypes
- Implement multi-column index parser (CREATE INDEX idx ON t(a, b))
- Add ciColumns to AST nkCreateIndex
- Build composite index keys as table.col1.col2 with val1|val2
- Support multi-column exact match in SELECT for AND chains
- Implement non-recursive CTE execution via ctx.cteTables materialization
- Add tkRecursive token and parse WITH RECURSIVE
- Fix test isolation: use temp dirs for JOIN, migration, and RLS tests
- All tests passing (0 failures)
This commit is contained in:
2026-05-07 10:27:40 +03:00
parent ca345eb256
commit eaa5760fd4
14 changed files with 300 additions and 46 deletions
+30
View File
@@ -137,3 +137,33 @@
BaraDB is production-ready for blogs, e-commerce, and small ERP systems.
262 tests across 56 suites — all passing. Stress test: 10000 ops, 0 errors, 555K ops/sec.
---
## 2026-05-07: Medium Priority Batch
### JSON/JSONB Types ✅
- `validateType` валидира JSON при INSERT/UPDATE
- `fkJson = 0x0D` добавен в `FieldKind`
- `valueToWire` връща `fkJson` за JSON/JSONB колони
- Всички 4 клиента обновени за JSON сериализация
### Column Type Metadata в Wire Protocol ✅
- `typeToFieldKind` helper в `server.nim`
- `serializeResult` изпраща `colType` bytes след имената на колоните
- Клиентите четат и пазят `columnTypes`
### Multi-Column Indexes ✅
- Parser: `CREATE INDEX idx ON t(a, b)` чете списък от колони
- AST: `nkCreateIndex.ciColumns: seq[string]`
- Executor: ключ `table.col1.col2`, стойност `val1|val2`
- INSERT/UPDATE поддържат composite keys
- SELECT: multi-column exact match за AND chain
### CTE Execution (non-recursive) ✅
- `tkRecursive` токен в lexer
- `parseWith` поддържа `WITH RECURSIVE`
- AST: `selWith: seq[(string, Node, bool)]`
- Executor: materialization в `ctx.cteTables`
- `execScan` проверява CTE store преди LSM
- `defer: ctx.cteTables.clear()` за cleanup