-
Notifications
You must be signed in to change notification settings - Fork 104
-
Hello, there is a Rust SQL crate called clorinde (a fork of cornucopia) where you write queries like this:
--: Author(age?) --! authors : Author SELECT name, age FROM Authors; --! authors_from_country (country?) : Author SELECT name, age FROM Authors WHERE Authors.nationality = :country;
And then clorinde, using the database schema, generates ergonomic Rust code that performs those queries.
The queries are in a format that is almost suitable for postgres-language-server, except that with it you write parameters :likethis
rather than the usual ?
or 1ドル
syntax used in prepared statements and SQL functions respectively. So at minimum there should be support in the parser for this syntax, and this limited support would be extremely useful already.
But also, the function signatures provided by clorinde can aid the postgres lsp: country?
there means that country is nullable (in the Rust side, it's an Option
). And I would like to hover the country
parameter and have the IDE tell me its type (in this case, it depends on the column nationality
of table Authors
).
Maybe this is not appropriate for the postgres lsp, and as such it would be necessary to create a language server specific for clorinde - but the postgres lsp does 95% of the job already, and I think it's a good fit.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
hey, thanks for the suggestion! unfortunately, we do not have control over the tokeniser and the parser. We are using libpg_query under the hood, and only support what they support.
Beta Was this translation helpful? Give feedback.