文件名称:sqlc-demo:SQLC演示和进行迁移
文件大小:32KB
文件格式:ZIP
更新时间:2024-03-05 15:07:26
Go
sqlc-demo 使用sqlc和go-migrate的简单演示 设置本地环境 make stack-up 创建查询的示例 -- name: GetAuthor :one SELECT * FROM authors WHERE id = $ 1 LIMIT 1 ; -- name: ListAuthors :many SELECT * FROM authors ORDER BY name; -- name: CreateAuthor :one INSERT INTO authors ( name, bio, reference ) VALUES ( $ 1 , $ 2 , $ 3 ) RETURNING * ; -- name: DeleteAuthor :exec DELETE FROM authors WHERE id = $ 1 ; 示范 端到端的可跟踪演示。 make
【文件预览】:
sqlc-demo-main
----.gitignore(383B)
----go.mod(435B)
----sql()
--------queries()
--------migrations()
----sqlc.yaml(436B)
----LICENSE(1KB)
----go.sum(51KB)
----README.md(2KB)
----stack.yml(204B)
----makefile(5KB)
----.golangci.yml(702B)
----cmd()
--------demo()
----internal()
--------pkg()