Skip to content

Commit bc81acd

Browse files
committed
test: add search_todos_by_details function
1 parent 0262ebc commit bc81acd

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

test/db/00-init.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ AS $$
210210
SELECT * FROM public.todos LIMIT 1;
211211
$$;
212212

213+
CREATE OR REPLACE FUNCTION public.search_todos_by_details(search_details text)
214+
RETURNS SETOF todos
215+
LANGUAGE SQL STABLE
216+
AS $$
217+
SELECT * FROM public.todos WHERE details ilike search_details;
218+
$$;
219+
213220
CREATE OR REPLACE FUNCTION public.get_todos_setof_rows(user_row users)
214221
RETURNS SETOF todos
215222
LANGUAGE SQL STABLE

test/lib/functions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ test('list set-returning function with multiples definitions', async () => {
118118
"definition": "
119119
SELECT * FROM public.todos WHERE "user-id" = user_row.id;
120120
",
121-
"id": 16508,
121+
"id": 16509,
122122
"identity_argument_types": "user_row users",
123123
"is_set_returning_function": true,
124124
"language": "sql",
@@ -153,7 +153,7 @@ test('list set-returning function with multiples definitions', async () => {
153153
"definition": "
154154
SELECT * FROM public.todos WHERE "user-id" = todo_row."user-id";
155155
",
156-
"id": 16509,
156+
"id": 16510,
157157
"identity_argument_types": "todo_row todos",
158158
"is_set_returning_function": true,
159159
"language": "sql",

test/server/typegen.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,14 @@ test('typegen: typescript', async () => {
830830
} & "Could not choose the best candidate function between: public.postgrest_unresolvable_function(a => int4), public.postgrest_unresolvable_function(a => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved"
831831
}
832832
| { Args: never; Returns: undefined }
833+
search_todos_by_details: {
834+
Args: { search_details: string }
835+
Returns: {
836+
details: string | null
837+
id: number
838+
"user-id": number
839+
}[]
840+
}
833841
test_internal_query: { Args: never; Returns: undefined }
834842
test_unnamed_row_composite: {
835843
Args: { "": Database["public"]["Tables"]["users"]["Row"] }
@@ -1902,6 +1910,14 @@ test('typegen w/ one-to-one relationships', async () => {
19021910
} & "Could not choose the best candidate function between: public.postgrest_unresolvable_function(a => int4), public.postgrest_unresolvable_function(a => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved"
19031911
}
19041912
| { Args: never; Returns: undefined }
1913+
search_todos_by_details: {
1914+
Args: { search_details: string }
1915+
Returns: {
1916+
details: string | null
1917+
id: number
1918+
"user-id": number
1919+
}[]
1920+
}
19051921
test_internal_query: { Args: never; Returns: undefined }
19061922
test_unnamed_row_composite: {
19071923
Args: { "": Database["public"]["Tables"]["users"]["Row"] }
@@ -2974,6 +2990,14 @@ test('typegen: typescript w/ one-to-one relationships', async () => {
29742990
} & "Could not choose the best candidate function between: public.postgrest_unresolvable_function(a => int4), public.postgrest_unresolvable_function(a => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved"
29752991
}
29762992
| { Args: never; Returns: undefined }
2993+
search_todos_by_details: {
2994+
Args: { search_details: string }
2995+
Returns: {
2996+
details: string | null
2997+
id: number
2998+
"user-id": number
2999+
}[]
3000+
}
29773001
test_internal_query: { Args: never; Returns: undefined }
29783002
test_unnamed_row_composite: {
29793003
Args: { "": Database["public"]["Tables"]["users"]["Row"] }
@@ -4051,6 +4075,14 @@ test('typegen: typescript w/ postgrestVersion', async () => {
40514075
} & "Could not choose the best candidate function between: public.postgrest_unresolvable_function(a => int4), public.postgrest_unresolvable_function(a => text). Try renaming the parameters or the function itself in the database so function overloading can be resolved"
40524076
}
40534077
| { Args: never; Returns: undefined }
4078+
search_todos_by_details: {
4079+
Args: { search_details: string }
4080+
Returns: {
4081+
details: string | null
4082+
id: number
4083+
"user-id": number
4084+
}[]
4085+
}
40544086
test_internal_query: { Args: never; Returns: undefined }
40554087
test_unnamed_row_composite: {
40564088
Args: { "": Database["public"]["Tables"]["users"]["Row"] }

0 commit comments

Comments
 (0)