Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support for clorinde #384

dlight started this conversation in Ideas
Discussion options

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;

(Example taken from here)

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.

You must be logged in to vote

Replies: 1 comment

Comment options

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.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /