Go (Golang) and Databases: A Practical Guide
300 pages
English
PDF
4.5

Go (Golang) and Databases: A Practical Guide

Go (Golang) and Databases: A Practical Guide

Author:

Year:

Summary:

This book is your practical guide to the world of databases in the Go (Golang) ecosystem. If you are already familiar with the basics of the language and want to learn how to work professionally with data, build high-load and reliable applications, this edition is for you.



What is this book about?

The book covers the full cycle of working with databases in Go: from installing drivers to implementing complex transactions and optimizing queries. You will master both classic relational DBMS (PostgreSQL, MySQL) and modern NoSQL solutions (MongoDB, Redis). Each chapter contains practical code examples ready for use in real projects.



Who is this book for?

  • Go developers who want to deepen their knowledge of working with databases;
  • Backend engineers transitioning from other languages to Golang;
  • Students and novice programmers learning modern approaches to data storage;
  • Team Leads who want to implement best practices for working with databases in their team.


What will you learn?

  • How to connect to various databases: PostgreSQL, MySQL, SQLite, MongoDB, Redis;
  • Working with connection pools and managing contexts (context.Context);
  • Writing efficient SQL queries and using prepared statements;
  • Implementing transactions with ACID guarantees;
  • ORMs and query builders: GORM, sqlx, pgx — when and what to choose;
  • Database schema migrations (golang-migrate, goose);
  • Working with NoSQL: document-oriented MongoDB models and key-value Redis stores;
  • Performance optimization: indexes, EXPLAIN ANALYZE, caching;
  • Security: protection against SQL injections, data encryption;
  • Testing code that works with databases (mock objects, testcontainers).


Why should you read it?

The book is written by a practicing developer with many years of experience. All examples are tested on current versions of Go (1.21+) and popular DBMS. You won't just get theory — you will learn to apply the knowledge immediately after reading. Special attention is paid to typical mistakes and ways to avoid them.



Whether you are creating microservices, REST APIs, or a monolithic application, this book will become your desktop companion. Start your journey to mastering data handling in Go today!

Recommendations