Skip to content

Commit 0457b60

Browse files
author
Viktor Pentyukhov
committed
First ydb-go-sdk generation version. Added :queryrows comment to support .Query(...) syntax
1 parent a44de04 commit 0457b60

File tree

17 files changed

+535
-145
lines changed

17 files changed

+535
-145
lines changed

examples/authors/sqlc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ sql:
5252
package: authors
5353
out: ydb
5454
emit_json_tags: true
55+
sql_package: ydb-go-sdk
5556

5657

5758
rules:

examples/authors/ydb/db.go

Lines changed: 8 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/authors/ydb/query.sql

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,8 @@ WHERE bio IS NULL;
1616
-- name: Count :one
1717
SELECT COUNT(*) FROM authors;
1818

19-
-- name: COALESCE :many
20-
SELECT id, name, COALESCE(bio, 'Null value!') FROM authors;
21-
22-
-- name: CreateOrUpdateAuthor :execresult
23-
UPSERT INTO authors (id, name, bio) VALUES ($p0, $p1, $p2);
24-
25-
-- name: CreateOrUpdateAuthorReturningBio :one
26-
UPSERT INTO authors (id, name, bio) VALUES ($p0, $p1, $p2) RETURNING bio;
19+
-- name: UpsertAuthor :queryrows
20+
UPSERT INTO authors (id, name, bio) VALUES ($p0, $p1, $p2) RETURNING *;
2721

2822
-- name: DeleteAuthor :exec
2923
DELETE FROM authors WHERE id = $p0;

examples/authors/ydb/query.sql.go

Lines changed: 125 additions & 116 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require (
2424
github.com/tetratelabs/wazero v1.9.0
2525
github.com/wasilibs/go-pgquery v0.0.0-20250409022910-10ac41983c07
2626
github.com/xeipuuv/gojsonschema v1.2.0
27-
github.com/ydb-platform/ydb-go-sdk/v3 v3.108.0
27+
github.com/ydb-platform/ydb-go-sdk/v3 v3.115.3
2828
github.com/ydb-platform/yql-parsers v0.0.0-20250309001738-7d693911f333
2929
golang.org/x/sync v0.13.0
3030
google.golang.org/grpc v1.72.0
@@ -48,7 +48,7 @@ require (
4848
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
4949
github.com/jackc/pgtype v1.14.0 // indirect
5050
github.com/jackc/puddle/v2 v2.2.2 // indirect
51-
github.com/jonboulle/clockwork v0.3.0 // indirect
51+
github.com/jonboulle/clockwork v0.5.0 // indirect
5252
github.com/mattn/go-isatty v0.0.20 // indirect
5353
github.com/ncruces/go-strftime v0.1.9 // indirect
5454
github.com/pingcap/errors v0.11.5-0.20240311024730-e056997136bb // indirect

0 commit comments

Comments
 (0)