O'Reilly logo

Go Web Development Cookbook by Arpit Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating your first record in MySQL

Creating or saving a record in a database requires us to write SQL queries and execute them, implement object-relational mapping (ORM), or implement data-mapping techniques.

In this recipe, we will be writing a SQL query and executing it using the database/sql package to create a record. To achieve this, you can also implement ORM using any library from a number of third-party libraries available in Go, such as https://github.com/jinzhu/gorm, https://github.com/go-gorp/gorp, and https://github.com/jirfag/go-queryset.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required