Golang database tools libraries comparison

Feature Golang database/sql GORM SQLC SQLX
Type Standard library ORM library Code generation tool Library extension
Ease of use Low - manual mapping SQL fields to variables High Medium Medium
SQL Abstraction None High Medium (Type-safe SQL) Low
Query Building No Yes No Yes
Automatic Struct Mapping No Yes Yes Yes
Type Safety No Yes Yes No
Supported Databases Any (with driver) MySQL, PostgreSQL, SQLite, SQL Server PostgreSQL, MySQL, SQLite Any (with driver)
Learning Curve Low Medium Medium Low
External Dependency No Yes Yes Yes
Performance on high load High Low High High
Code generation No No Yes - Catch SQL query errors before generating codes Yes - Failure won’t occur until runtime

SQLC + migrate is the prefect choice if the database is PostgreSQL.

This is the detail guide movie here ==> https://www.youtube.com/watch?v=0CYkrGIJkpw (Generate CRUD Golang code from SQL | Compare db/sql, gorm, sqlx & sqlc)