Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .runJSON to query builder expressions #316

Merged
merged 3 commits into from
Mar 28, 2022
Merged

Add .runJSON to query builder expressions #316

merged 3 commits into from
Mar 28, 2022

Conversation

colinhacks
Copy link
Contributor

No description provided.

? this
: wrappedExprCache.get(this) ??
wrappedExprCache.set(this, select(this)).get(this);
const _args = jsonifyComplexParams(expr, args);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, what's this btw? Why are we "jsonifying" arguments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We allow more complex parameter types and implicitly convert them to JSON on both ends: https://www.edgedb.com/docs/clients/01_js/parameters#complex-types This makes it possible to accept more complex data structures in query.run(client, parameters) to support an end-to-end typesafe workflow where you take a JSON payload, validate it with a schema library, and pass it in the params object, and type safety is enforced at every step along the way

@colinhacks colinhacks merged commit 231feb0 into master Mar 28, 2022
@colinhacks colinhacks deleted the runjson branch March 28, 2022 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants