Shorthand function support #489
blahbleepew
started this conversation in
General
Replies: 2 comments
-
Making changes to the query signature is not planned right now. Instead the plan is to integrate the The API I have in mind will look something like this: import {getUserData} from './queries';
// ...
const userData = await getUserData({ userId: 1 }); Internally There are a couple of important questions:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I solved this problem by creating a wrapper import type { PreparedQuery } from '@pgtyped/runtime'
const query = <P, R>(query: PreparedQuery<P, R>, params: P) => {
return query.run(params, client)
}
const user = await query(getUserData, {
userId
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to support a shorthand form? The way the functions are generated it takes a lot of linespace, especially when you have code formatters which want to put each argument on a separate line:
Ideally it would be nice to have something like this (if possible to get rid of .run as well):
Beta Was this translation helpful? Give feedback.
All reactions