You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "dehowef (via GitHub)" <gi...@apache.org> on 2023/04/14 00:07:26 UTC
[GitHub] [age] dehowef commented on issue #445: Write Swift Driver for AGE
dehowef commented on issue #445:
URL: https://github.com/apache/age/issues/445#issuecomment-1507752381
> @dehowef For safe parameter handling, the solution I landed on is built on PostgresNIO's string interpolation. This code:
>
> ```swift
> let params: Dictionary<String,AGValue> = ["newName": "Little'Bobby'Tables"]
> let paramsWrapper: AGValueWrapper = AGValueWrapper.init(value: params)
> let agRows = try await connection.execCypher(
> "SELECT * FROM cypher('test_graph_1', $$ CREATE (v:Person {name: $newName}) RETURN v $$, \( paramsWrapper )) as (v agtype);",
> logger: logger)
> ```
>
> will send the following query to Postgres:
>
> ```sql
> SELECT * FROM cypher('test_graph_1', $$ CREATE (v:Person {name: $newName}) RETURN v $$, $1) as (v agtype);
> ```
>
> with the `$1` parameter being a jsonb encoding of that Dictionary. Let me know if you see any concerns with that approach.
Hey! I was taking a break but I will take a look when I have a chance thank you for your contribution~
>
That's awesome to know. Great work! Thank you for your contribution
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org