bun
bun copied to clipboard
Documentation improvements and/or tutorial ideas
I have some spare time to work on improving docs and/or writing tutorials for Bun/PostgreSQL/MySQL. So please leave your feedback regarding docs here or suggest ideas for tutorials or share links to good tutorials.
I would like to take advantage of the availability of a professional like you to have in the docs insights/info/tutorials/ideas on:
- performance best practices (I know that this is a big issue and that you are already addressing it in some pages of the docs, but perhaps a dedicated section would be more appropriate and more "salable")
- creation of foreign keys (perhaps by automating the process with a Go script to always be launched after each code base change)
- creation of indexes suggested during development by Bun based on the use of queries
In short, for a database neophyte like me - who does not have a DBA or a department dedicated to this - it would be very useful to have these info, especially if they comes from a genius like you.
NOTE: I'm using Bun exclusively with Postgresql. But I think this applies on others DB too.
Thanks for the feedback.
performance best practices
We have https://bun.uptrace.dev/guide/running-bun-in-production.html#database-sql and that is all I know about Bun / database/sql. I probably will write more articles about Go/Postgres performance, but it is pretty broad topic...
creation of foreign keys (perhaps by automating the process with a Go script to always be launched after each code base change) creation of indexes suggested during development by Bun based on the use of queries
This sounds more like separate tools / feature requests. And they don't make my top 10 wanted features list ;)
I should create soon an attachments system in a small application using Postgres. The attachments will be small (max 25MB).
A page explaining the pros and cons would be interesting, like this: https://www.cybertec-postgresql.com/en/binary-data-performance-in-postgresql/
It would be great if you add a section about JSONB. I'm using JSONB's for custom types(particularly structs), a lot. I discovered that there is an auto marshal/unmarshal feature. In GORM it's painful, you need to implement some interfaces for every type.
See https://bun.uptrace.dev/postgres/data-types.html#jsonb . I have plans to write an article about model inheritance and/or polymorphic models that use JSON to store key/value data. Perhaps I will mention it there.
I saw that but there is no mention of structs. So I thought that there is no support for structs. Then I tried and it worked. JSON column type is not postgres specific. I don't know If there is MySQL JSON or other support in the bun, but you could mention in Extending Bun with custom types
Has there been any conversations about adding support for being able to query additional analytic stores like Apache Druid and BigQuery? I really like the way one can elegantly write queries using Bun and think it'd be a natural fit for additional stores, assuming one writes a dialect and driver.
@abfisher0417 that is very unlikely, but we have a separate ClickHouse client at https://github.com/uptrace/go-clickhouse. I plan to finish the docs and promote it more once Go 1.18 is released.
@vmihailenco I haven't been able to find any information on the pgdriver's compatibility with postgres versions.
@GabeAboy PostgreSQL protocol is very stable so pgdriver should work with any PostgreSQL version released in the past 10 years. That does not mean it supports all PostgreSQL features though.
It would be a good idea to add documentation about index management. I was unable to find any information about it in the documentation. The only place I found information about it was in the code example section.