Skip to content

Conversation

gaiottino
Copy link

https://google.github.io/sqlcommenter/ makes it possible to add tracing comments that can be interpreted by e.g. GCPs query analyser.

#872 added support for comments but they are prepended on a separate line and sqlcommenter requires the form /* … */ to be added on the same line as the query which is why I’ve added this PR and the qm.AppendComment function.

For example:

q := shop.Customers( qm.AppendComment("shop.getAllCustomers"), qm.Select("id", "name"), qm.From("customers"), ) 

will be:

SELECT id, name FROM customers; /* shop.getAllCustomers /* 
https://google.github.io/sqlcommenter/ makes it possible to add tracing comments that can be interpreted by e.g. GCPs query analyser. aarondl#872 added support for comments but they are prepended on a separate line and sqlcommenter requires the form `/* … */` to be added on the same line as the query which is why I’ve added this PR and the `qm.AppendComment` function. For example: ``` q := shop.Customers( qm.AppendComment("shop.getAllCustomers"), qm.Select("id", "name"), qm.From("customers"), ) ``` will be: ``` SELECT id, name FROM customers; /* shop.getAllCustomers /* ```
@aarondl
Copy link
Owner

aarondl commented Sep 26, 2021

You show this: qm.AppendComment("shop.getAllCustomers")

but I can't find that function in the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants