Demo repository for article on SQL database access in Go.
- The latest version of Go and PostgreSQL installed
Clone the repository:
git clone https://github.com/betterstack-community/go-database-access.git
cd go-database-access/
Build the project:
go build
Rename .env.example
to .env
and modify the PostgreSQL connection string as
needed.
Create a new database
through the psql
console named "gda".
Populate the gda
database:
./gda setup
Run code examples:
./gda example [connect|single|multi|parameterised|null|insert|transaction|struct|return|prepared|conn|timeout]
The code used in this project and in the linked tutorial are licensed under the Apache License, Version 2.0.