forked from sqlc-dev/sqlc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(codegen): Add support for pgvector and pgvector-go (sqlc-dev#2888)
* feat(codegen): Add support for pgvector-go * test: Update ddl_tests to use FindTests
- Loading branch information
1 parent
bd9919d
commit 3754349
Showing
12 changed files
with
166 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
internal/endtoend/testdata/pg_vector/postgresql/pgx/exec.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"contexts": ["base"] | ||
} |
32 changes: 32 additions & 0 deletions
32
internal/endtoend/testdata/pg_vector/postgresql/pgx/go/db.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
internal/endtoend/testdata/pg_vector/postgresql/pgx/go/models.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
internal/endtoend/testdata/pg_vector/postgresql/pgx/go/query.sql.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
internal/endtoend/testdata/pg_vector/postgresql/pgx/query.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- name: InsertVector :exec | ||
INSERT INTO items (embedding) VALUES ($1); | ||
|
||
-- name: NearestNeighbor :many | ||
SELECT * | ||
FROM items | ||
ORDER BY embedding <-> $1 | ||
LIMIT 5; |
3 changes: 3 additions & 0 deletions
3
internal/endtoend/testdata/pg_vector/postgresql/pgx/schema.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CREATE EXTENSION IF NOT EXISTS "vector"; | ||
|
||
CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3)); |
10 changes: 10 additions & 0 deletions
10
internal/endtoend/testdata/pg_vector/postgresql/pgx/sqlc.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: "2" | ||
sql: | ||
- engine: "postgresql" | ||
schema: "schema.sql" | ||
queries: "query.sql" | ||
gen: | ||
go: | ||
package: "querytest" | ||
out: "go" | ||
sql_package: "pgx/v5" |