Using an SQL database in Golang
Blog post from LogRocket
This tutorial guides readers through creating a console-based reminder application in Golang that utilizes a Microsoft SQL Server database to demonstrate the Twelve-factor app methodology's principle of stateless processes. It details the installation of Microsoft SQL Server via Docker, the creation of a database and a Reminders table, and the development of a Golang application using the go-mssqldb package for database connectivity. The tutorial covers implementing Create, Retrieve, and Delete operations for reminders and discusses using Golang’s sql package to manage SQL queries securely, highlighting the importance of employing validation libraries to prevent SQL injection attacks. It also touches on enhancing the application with CLI libraries and handling query timeouts using Golang's context package, offering a foundational framework for developers to build more complex applications.