GORM là gì?

1. GORM là gì? GORM (Go Object Relational Mapping) là một thư viện ORM dành cho ngôn ngữ lập trình Go, giúp ánh xạ các struct trong Go với dữ liệu trong cơ sở dữ liệu quan hệ như PostgreSQL, MySQL và SQLite. Thay vì phải tự viết SQL cho mọi thao tác truy vấn […]

Gin-Gonic

Gin-Gonic là gì? Hướng dẫn xây dựng REST API với Go 1. Gin-Gonic là gì? Gin-Gonic, thường được gọi là Gin, là một framework Web mã nguồn mở dành cho ngôn ngữ lập trình Go. Gin cung cấp các công cụ giúp lập trình viên xây dựng HTTP server và REST API, chẳng hạn như […]

Go Context

Go Context là gì? Hướng dẫn sử dụng Context trong Go 1. Context là gì? Trong Go, context là một package thuộc thư viện chuẩn, cung cấp cơ chế để quản lý thời hạn thực hiện công việc, gửi tín hiệu hủy tác vụ và truyền một số dữ liệu gắn với quá trình xử […]

Go Channels

Go Channels là gì? Vì sao cần Channel khi sử dụng Goroutine? 1. Channel là gì? Vì sao cần Channel? Trong Go, Channel là cơ chế cho phép các Goroutine trao đổi dữ liệu và phối hợp hoạt động với nhau. Ở bài viết trước(Goroutine & Concurrency), chúng ta đã tìm hiểu Goroutine — một […]

Goroutine & Concurrency

Goroutines & Concurrency 1. Concurrency là gì? Khi viết chương trình, có những công việc phải được thực hiện lần lượt, nhưng cũng có những công việc có thể tiến triển trong cùng một khoảng thời gian. Để hiểu cách Go xử lý nhiều công việc như vậy, trước tiên cần phân biệt ba khái […]

Go Fundamentals

Go là gì? Go, còn được biết đến với tên gọi Golang, là một ngôn ngữ lập trình mã nguồn mở, được thiết kế tại Google bởi Robert Griesemer, Rob Pike và Ken Thompson. Go là ngôn ngữ biên dịch (compiled language) và có hệ thống kiểu dữ liệu tĩnh (statically typed). Khác với những […]

Use docker to run go project

Docker is a powerful tool that enables developers to create, deploy and run applications in a containerized environment. Using Docker to run Go projects has many advantages, including the ability to isolate your application from the underlying operating system, simplifying the deployment process, and allowing for greater scalability and flexibility. In this guide, we will […]

Golang the basic concept of Go Programing

Go is a statically-typed, concurrent, and garbage-collected programming language developed by Google. Here are some of the basic concepts and guidelines for writing code in Go: Syntax: Go has a simple and straightforward syntax that is easy to learn. The language has a strict coding style, with specific rules for naming variables, functions, and types, […]

Clean code in writing Go program

When writing code in Go, it is important to follow good coding practices to ensure that your code is clean, maintainable, and scalable. Here are some clean code and clean architecture practices to follow: Go coding style: Follow the official Go coding style guide, which includes recommendations for naming conventions, formatting, and documentation. Consistent coding […]

Interfaces in Go and best practice

Interfaces in Go are a set of methods that defines a behavior. A type can implement an interface by defining methods with the same signatures as the methods defined in the interface. This allows for a form of polymorphism in Go, where a single function or method can operate on values of different types, as […]