Simple helper package to insert and upsert data into PostgreSQL using Bun ORM in Go.
This is a small utility package for personal and internal use — but feel free to use or adapt it.
- Connect to PostgreSQL via Bun + pgx
- Generic
ToDbfunction to insert or upsert slices of data - Automatically builds
ON CONFLICT DO UPDATEclause based on primary key and columns - No hardcoding of column names — uses
information_schemadynamically - set DEBUG_SQL=true to log SQL queries for debugging
go get github.com/imbence/pgdb