walterwanderley / sqlc-grpc

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

Masking SQLC queries in the resulting GRPC proto #11

Closed JamesArthurHolland closed 4 months ago

JamesArthurHolland commented 8 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 8 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]"