snapshot of https://github.com/sqlc-dev/sqlc.git (main, 2026-09-16; blobs > 131072B omitted)
Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled
Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled
This commit is contained in:
56
examples/batch/postgresql/query.sql
Normal file
56
examples/batch/postgresql/query.sql
Normal file
@@ -0,0 +1,56 @@
|
||||
-- name: GetAuthor :one
|
||||
SELECT * FROM authors
|
||||
WHERE author_id = $1;
|
||||
|
||||
-- name: DeleteBookExecResult :execresult
|
||||
DELETE FROM books
|
||||
WHERE book_id = $1;
|
||||
|
||||
-- name: DeleteBook :batchexec
|
||||
DELETE FROM books
|
||||
WHERE book_id = $1;
|
||||
|
||||
-- name: DeleteBookNamedFunc :batchexec
|
||||
DELETE FROM books
|
||||
WHERE book_id = sqlc.arg (book_id);
|
||||
|
||||
-- name: DeleteBookNamedSign :batchexec
|
||||
DELETE FROM books
|
||||
WHERE book_id = @book_id;
|
||||
|
||||
-- name: BooksByYear :batchmany
|
||||
SELECT * FROM books
|
||||
WHERE year = $1;
|
||||
|
||||
-- name: CreateAuthor :one
|
||||
INSERT INTO authors (name) VALUES ($1)
|
||||
RETURNING *;
|
||||
|
||||
-- name: CreateBook :batchone
|
||||
INSERT INTO books (
|
||||
author_id,
|
||||
isbn,
|
||||
book_type,
|
||||
title,
|
||||
year,
|
||||
available,
|
||||
tags
|
||||
) VALUES (
|
||||
$1,
|
||||
$2,
|
||||
$3,
|
||||
$4,
|
||||
$5,
|
||||
$6,
|
||||
$7
|
||||
)
|
||||
RETURNING *;
|
||||
|
||||
-- name: UpdateBook :batchexec
|
||||
UPDATE books
|
||||
SET title = $1, tags = $2
|
||||
WHERE book_id = $3;
|
||||
|
||||
-- name: GetBiography :batchone
|
||||
SELECT biography FROM authors
|
||||
WHERE author_id = $1;
|
||||
Reference in New Issue
Block a user