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

Support sqlcommenter comments #984

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

volatiletech#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
Member

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants