About:
This tool has been adapted from Genna - https://github.com/dizzyfool/genna which has been made for go-pg package. I think it will be cool to have same CLI but for Bun which is new evolution of go-pg
Although this CLI is targeted for Bun, you should be aware that it's still compatible with Postgres only.
I've done a lot of plain code replacements: current tests are fine, but I haven't managed cases with multiple FK's, composite FK's. I do know that this tool needs to manage DEFAULT values e.g. default:'SOME DEFAULT FUNCTION'
also, but this needs more affort (pull requests are welcome).
Requirements:
In most of the cases Bun [Postgres driver] models represent database's tables and relations. Bungen's main goal is to prepare those models by reading detailed information about PostrgeSQL database. The result should be several files with ready to use structs with Bun ORM package.
go get github.com/LdDl/bungen && go install github.com/LdDl/bungen@latest
bungen -h
Currently bungen support 3 generators:
-q
and -z
flags it is possible to create simple SELECT *
functions)Examples located in each generator