Skip to content

Commit 8401aad

Browse files
doc: Remove $ sign from parameter when using database/sql package (#1888)
Co-authored-by: Aleksey Myasnikov <[email protected]>
1 parent bbeb145 commit 8401aad

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

SQL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,9 @@ err := retry.DoTx(context.TODO(), db, func(ctx context.Context, tx *sql.Tx) erro
314314
DECLARE $ts AS Datetime;
315315
SELECT season_id FROM seasons WHERE title LIKE $title AND views > $views AND first_aired > $ts;
316316
`,
317-
sql.Named("$title", "%Season 1%"), // argument name with prefix `$`
317+
sql.Named("title", "%Season 1%"), // argument name with without prefix `$`
318318
sql.Named("views", uint64(1000)), // argument name without prefix `$` (driver will prepend `$` if necessary)
319-
sql.Named("$ts", types.DatetimeValueFromTime( // native ydb type
319+
sql.Named("ts", types.DatetimeValueFromTime( // native ydb type
320320
time.Now().Add(-time.Hour*24*365),
321321
)),
322322
)
@@ -401,7 +401,7 @@ func main() {
401401
DECLARE $p0 AS Int32;
402402
DECLARE $p1 AS Utf8;
403403
SELECT $p0, $p1`,
404-
sql.Named("$p0", 42),
404+
sql.Named("p0", 42),
405405
table.ValueParam("$p1", types.TextValue("my string")),
406406
)
407407
// process row ...

0 commit comments

Comments
 (0)