Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e949b19
Initial YDB support: SELECT logic, some convert tests, and YDB engine…
1NepuNep1 Apr 22, 2025
4e46daa
Added almost full INSERT support and basic DELETE (without ON) support
1NepuNep1 Apr 26, 2025
3a4f818
Added UPDATE and DELETE full logic. Updated examples in example/authors
1NepuNep1 Apr 28, 2025
e980d19
Added some examples and README for demo
1NepuNep1 Apr 28, 2025
3013c84
Supported some more YQL constructions:
1NepuNep1 May 17, 2025
e687cf6
ADDED DROP/ALTER USER/GROUP
1NepuNep1 May 19, 2025
0293f6a
Added Funcs support!
1NepuNep1 May 20, 2025
fc8c932
Added examples for funcs codegen
1NepuNep1 May 21, 2025
d0e1550
Upgraded jwt to 4.5.2
1NepuNep1 May 27, 2025
0b1752a
First ydb-go-sdk generation version (See #4) (#6)
1NepuNep1 Sep 2, 2025
4eb8ff5
Bump sqlc version in examples/authors/ydb to v1.30.0
Sep 3, 2025
14b60c5
Rewrited comments and testdata to eng
Sep 3, 2025
f2d7aea
Expanding YQL Syntax support in sqlc engine (Refactored SELECT (Suppo…
1NepuNep1 Sep 8, 2025
296cca7
Made new params building logic & got rid off .Query handle (#11)
1NepuNep1 Sep 9, 2025
1379e43
Rewrited convert to Visitor Interface from ANTLR4 + fixed some types …
1NepuNep1 Sep 23, 2025
a680b1b
Massive Optional + Functions update (#13)
1NepuNep1 Sep 26, 2025
a69429c
Added simple types in param builder and ydbType (#14)
1NepuNep1 Oct 8, 2025
816eda8
Ydb-go-sdk codegen: Containers support in ydb.ParamsBuilder() (#15)
1NepuNep1 Oct 9, 2025
2eaa5d0
Tests: Added a lot of ydb e2e tests + some engine and types fixes
1NepuNep1 Oct 27, 2025
bde9d5e
Merge branch 'main' into ydb
1NepuNep1 Oct 27, 2025
08424e0
Resolved go.mod && go.sum
1NepuNep1 Oct 27, 2025
be13a37
Fixed builtins test
1NepuNep1 Oct 27, 2025
683926c
Added docs and rewrited examples for ydb (#17)
1NepuNep1 Oct 27, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added some examples and README for demo
  • Loading branch information
1NepuNep1 authored and Viktor Pentyukhov committed Sep 3, 2025
commit e980d194e4ddda2fcab2c598d5c50b1d7e7ddf02
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build build-endtoend test test-ci test-examples test-endtoend start psql mysqlsh proto
.PHONY: build build-endtoend test test-ci test-examples test-endtoend start psql mysqlsh proto sqlc-dev ydb test-examples-ydb gen-examples-ydb

build:
go build ./...
Expand All @@ -18,13 +18,21 @@ vet:
test-examples:
go test --tags=examples ./...

ydb-examples: sqlc-dev ydb gen-examples-ydb test-examples-ydb

test-examples-ydb:
YDB_SERVER_URI=localhost:2136 go test -v ./examples/authors/ydb/... -count=1

gen-examples-ydb:
cd examples/authors/ && SQLCDEBUG=1 ~/bin/sqlc-dev generate && cd ../..

build-endtoend:
cd ./internal/endtoend/testdata && go build ./...

test-ci: test-examples build-endtoend vet

sqlc-dev:
go build -o ~/bin/sqlc-dev ./cmd/sqlc/
go build -x -v -o ~/bin/sqlc-dev ./cmd/sqlc/

sqlc-pg-gen:
go build -o ~/bin/sqlc-pg-gen ./internal/tools/sqlc-pg-gen
Expand All @@ -38,6 +46,9 @@ test-json-process-plugin:
start:
docker compose up -d

ydb:
docker compose up -d ydb

fmt:
go fmt ./...

Expand Down
47 changes: 47 additions & 0 deletions examples/authors/ydb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Инструкция по генерации

В файлах `schema.sql` и `query.sql` записаны, соответственно, схема базы данных и запросы, из которых вы хотите сгенерировать код к базе данных.
В `db_test.go` находятся тесты для последних сгенерированных команд.
Ниже находятся команды для генерации и запуска тестов.

---

### 1. Создание бинарника sqlc

```bash
make sqlc-dev
```

### 2. Запуск YDB через Docker Compose

```bash
make ydb
```

### 3. Генерация кода для примеров для YDB

```bash
make gen-examples-ydb
```

### 4. Запуск тестов примеров для YDB

```bash
make test-examples-ydb
```

### 5. Полный цикл: сборка, генерация, тестирование (удобно одной командой)

```bash
make ydb-examples
```

Эта команда выполнит:

- Сборку `sqlc-dev`
- Запуск контейнера YDB
- Генерацию примеров
- Тестирование примеров

---

4 changes: 2 additions & 2 deletions internal/sqltest/local/ydb.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ type TestYDB struct {
func link_YDB(t *testing.T, migrations []string, rw bool) TestYDB {
t.Helper()

// 1) Контекст с таймаутом
time.Sleep(1 * time.Second) // wait for YDB to start

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

Expand Down Expand Up @@ -78,7 +79,6 @@ func link_YDB(t *testing.T, migrations []string, rw bool) TestYDB {
}
prefix := fmt.Sprintf("%s/%s", baseDB, name)

// 2) Открываем драйвер к корню "/"
rootDSN := fmt.Sprintf("grpc://%s?database=%s", dbuiri, baseDB)
t.Logf("→ Opening root driver: %s", rootDSN)
driver, err := ydb.Open(ctx, rootDSN,
Expand Down