feat(clients): add nim-allographer client with BaraDB driver support
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

- Pure Nim wire protocol client (async + sync, no C FFI)
- Query Builder: fluent API, SQL generator, execution, transactions
- Schema Builder: create/alter/drop tables, column operations
- Connection pool with aging and timeout handling
- ORM integration via compile-time DB_BARADB switch
- Tests: test_open, test_query
- Documentation: README.md, PLAN_BARADB.md
This commit is contained in:
2026-05-21 15:49:11 +03:00
parent 2d310a33a1
commit 6bfc5b3a3c
654 changed files with 109419 additions and 0 deletions
@@ -0,0 +1,32 @@
import std/json
import std/strformat
import std/asyncdispatch
import std/oids
import std/times
import ../../../../src/allographer/query_builder
import ../../connection
import ../../schema
proc postSeeder*() {.async.} =
seeder(rdb, "post"):
let postCount = rdb.table("post").count().await
if postCount > 0:
return
let users = rdb.table("user").get().orm(UserTable).await
if users.len == 0:
raise newException(ValueError, "No users found in database")
var postList: seq[JsonNode]
for i in 1..users.len:
let row = PostTable(
id: $genOid(),
title: &"post {i}",
content: &"content {i}",
user_id: users[i-1].id,
created_at: now().toTime().toUnix().int,
updated_at: now().toTime().toUnix().int
)
postList.add(%row)
rdb.table("post").insert(postList).await
@@ -0,0 +1,24 @@
import std/json
import std/strformat
import std/asyncdispatch
import std/oids
import std/times
import ../../../../src/allographer/query_builder
import ../../connection
import ../../schema
proc userSeeder*() {.async.} =
seeder(rdb, "user"):
var userList: seq[JsonNode]
for i in 1..10:
let row = UserTable(
id: $genOid(),
name: &"user {i}",
email: &"user{i}@example.com",
password: &"password{i}",
created_at: now().toTime().toUnix().int,
updated_at: now().toTime().toUnix().int,
)
userList.add(%row)
rdb.table("user").insert(userList).await
@@ -0,0 +1,16 @@
import std/asyncdispatch
import std/os
import ./data/user_seeder
import ./data/post_seeder
proc seed() {.async.} =
let env = getEnv("APP_ENV")
if env != "develop":
raise newException(CatchableError, "This command is only available in the develop environment")
userSeeder().await
postSeeder().await
seed().waitFor()
@@ -0,0 +1,14 @@
import std/asyncdispatch
import std/os
import ./data/user_seeder
import ./data/post_seeder
proc seed() =
let env = getEnv("APP_ENV")
if env != "production":
raise newException(Exception, "This command is only available in the production environment")
userSeeder().waitFor()
postSeeder().waitFor()
seed()
@@ -0,0 +1,14 @@
import std/asyncdispatch
import std/os
import ./data/user_seeder
import ./data/post_seeder
proc seed() =
let env = getEnv("APP_ENV")
if env != "staging":
raise newException(Exception, "This command is only available in the staging environment")
userSeeder().waitFor()
postSeeder().waitFor()
seed()