Skip to content

Commit e1f7d2a

Browse files
committed
Setup pg typed functions test env
1 parent bca17cd commit e1f7d2a

File tree

8 files changed

+143
-5
lines changed

8 files changed

+143
-5
lines changed

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: build build-endtoend test test-ci test-examples test-endtoend start psql mysqlsh proto
1+
.PHONY: build build-endtoend test test-ci test-examples test-endtoend start psql mysqlsh proto sqlc
22

33
build:
44
go build ./...
@@ -23,17 +23,20 @@ build-endtoend:
2323

2424
test-ci: test-examples build-endtoend vet
2525

26+
sqlc:
27+
go build -o ./bin/sqlc ./cmd/sqlc/
28+
2629
sqlc-dev:
27-
go build -o ~/bin/sqlc-dev ./cmd/sqlc/
30+
go build -o ./bin/sqlc-dev ./cmd/sqlc/
2831

2932
sqlc-pg-gen:
30-
go build -o ~/bin/sqlc-pg-gen ./internal/tools/sqlc-pg-gen
33+
go build -o ./bin/sqlc-pg-gen ./internal/tools/sqlc-pg-gen
3134

3235
sqlc-gen-json:
33-
go build -o ~/bin/sqlc-gen-json ./cmd/sqlc-gen-json
36+
go build -o ./bin/sqlc-gen-json ./cmd/sqlc-gen-json
3437

3538
test-json-process-plugin:
36-
go build -o ~/bin/test-json-process-plugin ./scripts/test-json-process-plugin/
39+
go build -o ./bin/test-json-process-plugin ./scripts/test-json-process-plugin/
3740

3841
start:
3942
docker compose up -d

bin/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

internal/endtoend/testdata/ddl_create_function_table/postgresql/pgx/v5/go/db.go

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

internal/endtoend/testdata/ddl_create_function_table/postgresql/pgx/v5/go/models.go

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

internal/endtoend/testdata/ddl_create_function_table/postgresql/pgx/v5/go/query.sql.go

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- name: SelectAll :many
2+
SELECT * FROM public.get_test();
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
-- Create mock test table
2+
create table if not exists public.test_data
3+
(
4+
test_id integer,
5+
test_date date,
6+
test_time timestamp with time zone,
7+
test_string text,
8+
test_varchar character varying,
9+
test_double double precision
10+
);
11+
12+
create function public.get_test(input_time timestamp without time zone DEFAULT now())
13+
returns TABLE
14+
(
15+
test_id integer,
16+
test_date date,
17+
test_time timestamp with time zone,
18+
test_string text,
19+
test_varchar character varying,
20+
test_double double precision
21+
)
22+
stable
23+
language sql
24+
as
25+
$$
26+
SELECT test_id,
27+
test_date,
28+
test_time,
29+
test_string,
30+
test_varchar,
31+
test_double
32+
FROM public.test_data
33+
WHERE test_time <= input_time
34+
$$;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": "1",
3+
"packages": [
4+
{
5+
"path": "go",
6+
"engine": "postgresql",
7+
"sql_package": "pgx/v5",
8+
"name": "querytest",
9+
"schema": "schema.sql",
10+
"queries": "query.sql"
11+
}
12+
]
13+
}

0 commit comments

Comments
 (0)