sqlboiler icon indicating copy to clipboard operation
sqlboiler copied to clipboard

Support sqlcommenter comments

Open gaiottino opened this issue 4 years ago • 1 comments

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

https://github.com/volatiletech/sqlboiler/pull/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 /*

gaiottino avatar Aug 23 '21 10:08 gaiottino

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

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

aarondl avatar Sep 26 '21 16:09 aarondl