
Generate Go model from database design - duythinht
https://github.com/duythinht/dbml-go
======
duythinht
[https://www.dbml.org](https://www.dbml.org) is awesome, so I have wrote a
tool, which parse DBML from both local file or from dbdiagram.io to go struct
model.

~~~
Shelnutt2
I've never heard of dbml before, seems like its been out for about a year. I'm
always interested in managing schemas in a db-agnostic fashion. Seems like
overtime everything always devolves into db specific schemas (spatial indexes,
new datatypes like JSON, etc). I'll read into this and add it to my list to
watch.

Thanks for sharing this and your work.

------
_bxg1
I don't know why people don't do more of this sort of thing. Keeping models
aligned between DB/API/UI/whatever else is a laborious and error-prone
process. It's a perfect candidate for a DRY solution.

------
cybrexalpha
What is it with Go's love of code generation? Everything from protocol
implementations to database connections seems to generate a large wad of Go
code. Is it just to workaround the lack of Generics?

~~~
bagol
I think it's. Usually, compiler generates each concrete implementation for
generic. But in go, that's programmer's job. Maybe it's trade off for
language's simplicity.

~~~
erik_seaberg
This is an opportunity to use a higher-level DRY language to drive the code
generator, and treat Go like assembly.

------
davelondon
Hey you're using my github.com/dave/jennifer package for the code generation.
Glad it's helpful!

~~~
duythinht
It's an awesome package for generate go code :)

