Understanding the Importance of Separating DTO, Entity and Model in Application Development
In Golang application development, we often find a single struct object used for various purposes, such as representing data in the database as well as payload in API requests and responses. Although this seems practical, this approach can actually create problems related to security and maintenance. This article will discuss the importance of separating DTO, Entity and Model by applying some Domain-Driven Design (DDD) principles. ...
Database Transaction Implementation Techniques in Logic Layer for Golang Backend
Database transactions are a crucial aspect in application development, especially in projects that demand high data consistency. This article will discuss how to perform database transactions in the service layer (logic), while maintaining clean architecture principles and separation of concerns. ...
Pagination Optimization: Why Limit-Offset Can Be a Time Bomb and Cursor Pagination as the Solution
Pagination is a technique for dividing database query results into smaller chunks. Using LIMIT OFFSET queries is the most commonly used method. However, this method has several weaknesses, especially in terms of performance on very large datasets. This article will discuss problems that arise when using LIMIT OFFSET and explore more efficient alternatives, such as cursor-based pagination and seek method. ...
Folder Structure and Code Writing Rules in Golang Projects: Personal Preferences
Often, the Golang programs we create are not just REST-API servers, but also include other functions such as Event Consumers, Schedulers, CLI Programs, Database Backfills, or combinations of all of them. This project structure guideline can be used to enable all of that. This structure focuses on separating core logic from external dependencies, allowing code reuse across various application modes. Repository Link: https://github.com/muchlist/templaterepo ...
Pay Attention to These Things When Using Golang Goroutines
In backend development with Golang, managing background processes using goroutines is a common practice that can improve application performance. However, there are several common problems often encountered when implementing goroutines, especially regarding panic handling, context management, and proper shutdown processes. This article will review some common mistakes related to goroutine usage and how to overcome them. ...
Profiling Techniques in Golang
Profiling is the process of measuring application performance to identify and analyze various aspects that affect performance, such as CPU usage, memory, and goroutines. Profiling is very important in the development process to ensure applications run efficiently and optimally and to detect anomalies. ...