xialvjun / ts-sql-plugin

TypeScript Language Service Plugin for SQL with a tagged template strings SQL builder.

Repository from Github https://github.comxialvjun/ts-sql-pluginRepository from Github https://github.comxialvjun/ts-sql-plugin

sql.mock

darky opened this issue · comments

Would be good to have universal sql.mock method for resolving any problem.
Example:

SELECT ${sql.mock('*', entityToFields())} FROM test

First argument is passed to ts-server, second to runtime

Also this can help with #2 problem too

sql.mock is not bad, just like eslint ignore line, but what does it do? I mean in sql`select ${sql.mock('*', entityToFields())} from test`, what's entityToFields()?

I need more concret scene. Leave this issue open when people came up with a concret scene.

sql.mock should simply return second argument.
Example:

select ${sql.mock('*', 'user_name')} from users
return select * from users to tsserver static compilation
return select user_name from users to runtime

fixed here #10