Skip to content
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

Expose Comment Metadata to plugin Types. #3589

Open
Smithx10 opened this issue Sep 8, 2024 · 3 comments
Open

Expose Comment Metadata to plugin Types. #3589

Smithx10 opened this issue Sep 8, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Smithx10
Copy link

Smithx10 commented Sep 8, 2024

What do you want to change?

Currently, I am in the process of replacing Ent with SQLC. Our workflow involves writing our database schema, generate functions that map to sql queries, which sqlc accomplishes wonderfully, and then generate .proto messages for use in our gRPC APi. Typically we import them to our request_response.proto. In Ent this was done via https://github.com/ent/contrib/tree/master/entproto

Comment annotations in line with the schema will allow plugin authors apply logic to for example:

  • not generate messages for a user_groups table. plugin.Table annotation
  • annotate a .proto field number. plugin.Column

The functions for the compiler to collect the comments from the Schema files looks like it could be altered to accomplish this. I don't believe this will have any negative effects to the project.

What database engines need to be changed?

No response

What programming language backends need to be changed?

No response

@Smithx10 Smithx10 added the enhancement New feature or request label Sep 8, 2024
@Smithx10
Copy link
Author

Smithx10 commented Sep 8, 2024

Not sure if we will be able to easily get Column level comments from the parser. pganalyze/libpg_query#103 Looks like they added comments, but no one has caught up to it.

@Smithx10
Copy link
Author

Smithx10 commented Sep 9, 2024

I've created a quick first pass PoC to generate messages from sqlc:

https://github.com/Smithx10/sqlc-gen-proto

@Smithx10
Copy link
Author

Would like to have #3596 , When generating .proto files the Primary key should always be field 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant