2

Golang database tools libraries comparison

 11 months ago
source link: https://willzhuang.github.io/2023/05/17/Golang%20database%20tools%20libraries%20comparison/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Golang database tools libraries comparison

2023-05-17

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)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK