walterwanderley / sqlc-grpc

Create a gRPC server from code generated by sqlc
MIT License
123 stars 13 forks source link

Masking SQLC queries in the resulting GRPC proto #11

Closed JamesArthurHolland closed 2 months ago

JamesArthurHolland commented 5 months ago

When writing transactions, I write a few sqlc queries then write a custom RPC in the proto in order to run the queries as a transaction.

The issue I find is that all of these subqueries become externally accessible via the RPC because they all get added.

Have you thought of a way to encapsulate these types of internal queries so they aren't exported to the proto?

It would keep the proto cleaner and also means (as part of a larger team) that team members don't need to be aware of the hidden dangers of calling the wrong RPC individually when it was meant only to run as part of a larger transaction.

walterwanderley commented 5 months ago

Use the command line parameter -i to ignore queries. Ex:

To ignore queries that start with a lower case:

sqlc-grpc -i "^[a-z]"