drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: Query Comments
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Describe what you want
I think it would be nice to have a method to add a comment at the end of the query.
This would make it easier to know where the query is coming from. A popular provider that make good use of the comments are [Planetscale](https://planetscale.com/docs/concepts/query-insights#notable-queries), following the [google(sqlcommenter) format](https://google.github.io/sqlcommenter/).
I don't think is needed to ensure any formatting to it besides maybe not allowing `/*` and `*/`.
Suggestions:
Add a method called ".comment()", which receives a string and append it as a comment to the end of the query. e.g:
```ts
const result = await db.query.users.findMany({
with: {
posts: true
},
}).comment("application:'myproject', handler:'GO Api' ")
```
Or maybe:
```ts
const result = await db.query.users.findMany({
with: {
posts: true
},
comment: {
application: "myproject",
handler: "GO Api"
}
})
```
Contributor guide
Assessment
This issue has not been assessed yet.