SQL injection is a method used by hackers to attempt to trick your code into running arbitrary (read - REALLY BAD) queries on your database.
Learn how to query for multiple records using Go's database/sql package by querying for several users in a users table.
In this article we cover how to query for a single record using Go's database/sql package, including handling the ErrNoRows error.
When I first started writing Go code I was working on a relatively simple web application backed by an SQL database, so the first thing I did was Google “golang sql” which lead me to to the database/sql package. While reading those docs I notice this line in particular. The sql package must be used in conjunction with a database driver. See https://golang.org/s/sqldrivers for a list of drivers.
In this guide we walk through installing PostgreSQL 9.6 along with the command line tools on Mac OS X (10.7 or later).
Sign up for my mailing list and I'll send you a FREE sample from my course - Web Development with Go. The sample includes three chapters from the book, and over 2.5 hours of screencasts.
You will also receive notifications when I release new articles, along with other freebies that I only share with my mailing list.
Jon Calhoun is a full stack web developer who also teaches about Go, web development, algorithms, and anything programming related. He also consults for other companies who have development needs. (If you need some development work done, get in touch!)
Jon is a co-founder of EasyPost, a shipping API that many fortune 500 companies use to power their shipping infrastructure, and prior to founding EasyPost he worked at google as a software engineer.
©2018 Jonathan Calhoun. All rights reserved.