Anyone who’s starting to work with Golang can note some lower productivity compared with another languages when building the layer of the database. This includes a lot of repeated SQL code that makes us waste time worrying about things that do not add value to what we want to deliver.

To see how this lib works on the field, I built a little example project of a book library that has CRUD operations. Here you will see how insert, update, delete, do queries, and how to handle transactions on the database in a simple way.

The book library API has five operations:

  • POST /books (Insert a new book on the library)
  • GET /books/{bookID} (Get a book by your ID on the library)
  • PUT /books/{bookID} (Update a book on the library)
  • DELETE /books/{bookID} (Delete a book on the library)
  • GET /books (Get all books on the library)

#chi #golang #database-layer #mysql #orm

Looking for an ORM to database layer with Golang
4.85 GEEK