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
40 lines
1.0 KiB
Markdown
40 lines
1.0 KiB
Markdown
# Схема на BaraDB
|
|
|
|
BaraDB използва схема с типове, наследяване и автоматични миграции.
|
|
|
|
## Дефиниране на Типове
|
|
|
|
```nim
|
|
import barabadb/schema/schema
|
|
|
|
var s = newSchema()
|
|
|
|
let person = newType("Person")
|
|
person.addProperty("name", "str", required = true)
|
|
person.addProperty("age", "int32")
|
|
s.addType("default", person)
|
|
```
|
|
|
|
## Наследяване на Типове
|
|
|
|
```nim
|
|
let employee = newType("Employee")
|
|
employee.setBases(@["Person"])
|
|
employee.addProperty("department", "str")
|
|
s.addType("default", employee)
|
|
|
|
let resolved = s.resolveInheritance(employee)
|
|
```
|
|
|
|
## Типове Полета
|
|
|
|
| Тип | Описание |
|
|
|-----|---------|
|
|
| `str` | Низ |
|
|
| `int32` | 32-битово цяло число |
|
|
| `int64` | 64-битово цяло число |
|
|
| `float32` | 32-битов float |
|
|
| `float64` | 64-битов float |
|
|
| `bool` | Булева стойност |
|
|
| `datetime` | Дата/час |
|
|
| `bytes` | Двоични данни | |