Skip to content

Commit

Permalink
Merge branch 'master' into add_array_support
Browse files Browse the repository at this point in the history
  • Loading branch information
imor committed Nov 30, 2023
2 parents 280fdea + b4bfc87 commit fc32d09
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@

## master
- bugfix: make non-default args non-null in UDFs
- bugfix: default value of a string type argument in a UDF was wrapped in single quotes
- feature: add support for array types in UDFs
15 changes: 7 additions & 8 deletions docs/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For example, a function to add two numbers will be available on the query type a

```graphql
type Query {
addNums(a: Int, b: Int): Int
addNums(a: Int!, b: Int!): Int
}
```

Expand Down Expand Up @@ -62,7 +62,7 @@ Functions marked `immutable` or `stable` are available on the query type. Functi

```graphql
type Mutation {
addAccount(email: String): Int
addAccount(email: String!): Int
}
```

Expand Down Expand Up @@ -110,11 +110,11 @@ Built-in GraphQL scalar types `Int`, `Float`, `String`, `Boolean` and [custom sc
as $$ select id, email from account where id = "accountId"; $$;
```

=== "MutationType"
=== "QueryType"

```graphql
type Mutation {
addAccount(email: String): Int
type Query {
accountById(email: String!): Account
}
```

Expand Down Expand Up @@ -161,7 +161,7 @@ Since Postgres considers a row/composite type containing only null values to be
(2, '[email protected]', null),
(null, null, null);

create function returns_account_with_all_null_columns()
create function "returnsAccountWithAllNullColumns"()
returns account language sql stable
as $$ select id, email, name from account where id is null; $$;
```
Expand Down Expand Up @@ -217,7 +217,7 @@ Functions returning multiple rows of a table or view are exposed as [collections
```graphql
type Query {
accountsByEmail(
emailToSearch: String
emailToSearch: String!

"""Query the first `n` records in the collection"""
first: Int
Expand Down Expand Up @@ -414,7 +414,6 @@ Functions with default arguments can have their default arguments omitted.

The following features are not yet supported. Any function using these features is not exposed in the API:

* Functions that return a record type
* Functions that accept a table's tuple type
* Overloaded functions
* Functions with a nameless argument
Expand Down
2 changes: 1 addition & 1 deletion src/sql_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl<'a> ArgsIterator<'a> {
25 => trimmed
.strip_suffix("::text")
.to_owned()
.map(|i| i.trim_matches(',').to_string()),
.map(|i| i.trim_matches(',').trim_matches('\'').to_string()),
_ => None,
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/expected/function_calls.out
Original file line number Diff line number Diff line change
Expand Up @@ -2436,7 +2436,7 @@ begin;
"name": "String", +
"ofType": null +
}, +
"defaultValue": "'hello'"+
"defaultValue": "hello" +
} +
], +
"name": "funcWithDefaults" +
Expand Down

0 comments on commit fc32d09

Please sign in to comment.