-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature Question: Any raw sql in ts files are accepted? #62
Comments
@PorcoRosso85 Thank you for issue!!!!!!!!
Yes!!! I'm planning it in TODOs. Line 48 in ecd1f3c
sqlsurge use AST to extract raw SQLs, so it is possible to support any ORM libraries or user-defined functions. I'm considering the vscode settings. For example, there is a code like this, const result = fooQueryFunc(connection, "SELECT name FROM users WHERE id = 123"); And "sqlsurge.custom": {
"language": "typescript",
"function": "fooQueryFunc",
"templateLiteral": false,
"argNum": 1 // 0-indexed
} It would also be possible to handle cases where SQL is split like this, const baseSql = "SELECT name FROM users";
const condition1 = "WHERE id = 1";
const condition2 = "WHERE id = 2";
const result = fooQueryFunc(connection, baseSql + condition); I'll support it in the future. |
@PorcoRosso85 |
Own functions, maybe. No orm library. I'm writing raw sql files as both of DDL and DML, I'm searching one like yours that supports us to write type safed sql in ts file. |
This feature will take time, but I'll do my best to release it soon! |
By the way, will sqls server work any database server if these are live? Do yo know? |
@PorcoRosso85 |
Enough. If we use postgres, is what we only have to do is connecting live postgres server for sqls to suggest auto completion? sqlsurge doesn't require these as sqls doc explaining? MySQL(Go-MySQL-Driver) |
@PorcoRosso85 Yes, connection only. |
@PorcoRosso85 I created new issue about this: #66 |
Hi.
I found this explaination:
https://marketplace.visualstudio.com/items?itemName=senken.sqlsurge
Supporting raw SQL query
[Prisma in TypeScript
SQLx in Rust
This means that we should use prisma if we want to make ts file autocompleted by vscode?
The text was updated successfully, but these errors were encountered: