​​Our Go is fine but our SQL is great
Ben Linsay

Mixing a declarative language (SQL) with an imperative one (Go and most of the others) will always be troublesome, people are trying to solve this problem for decades.

I worked with repositories using plain SQL for 2 years, it was tough, specially hydrating aggregates. In many cases we would have many read models representing the same aggregates because they were so heavy to handle.

Now I’m working with Active Record again and it’s easy to do CRUD in simple models, but it gets complicated when working with aggregates and we end up using SQL to query or update in some cases.

I had a brieaf time working with GAE Datastore and it felt more natural, but I didn’t need projections/reports of what I was doing.

Using the repository pattern to abstract out infrastructure is a safe bet as you can do whatever you want behind it, even mixing data sources.

Like what you read? Give Thiago Marini a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.