Document `mock`
rattrayalex opened this issue · comments
This seems like an awesome tool but I am a little confused trying to figure out how to use it from reading the README alone.
Can you explain more what is sql.mock<X>
?
Example:
sql`select * from users where user_id = ${sql.mock<'1'>(userId)}`
Here in compile time you receive:
select * from users where user_id = 1
In runtime:
select * from users where user_id = $1
sql.mock
helps to "mock" placeholders for compile time. Cost of queries will be more precise in this case.
Got it. Very cool technique.
Would you like me to add that to the readme?
Actually, I might be interested in rewriting the readme to be more explicit and explain more things, if you would like that? Right now, I feel you probably need to download and run the tool to really understand it, which might be a barrier to adoption.
Yep, contribution welcome! Thanks!
Okay, thanks, I'll try to take a look at reworking the readme soon!