A COMPARISON BETWEEN LAYERS OF PERSISTENCE USING GOLANG: native driver and GORM - Nunes, Paulo; Conceição, Gislaine Cristina da (Revista Interface Tecnológica, 2025)
Golang offers two main approaches to data persistence: native driver and GORM. The native driver uses the database/sql package, providing greater control over queries and connections, and ensuring high performance by avoiding additional abstractions. However, it requires more code for transaction management and type conversion. GORM, an ORM for Golang, simplifies database access by allowing operations using Go structures, reducing the need to write SQL manually. It offers ease of use, automatic table mapping, and simplified connection management, but may sacrifice performance for complex queries. In short, the native driver is ideal for applications that require maximum performance and flexibility, while GORM makes code development and maintenance easier. The choice between them depends on the necessary balance between performance, control, and productivity in the project.