Use Go to easily complete a SAGA distributed transaction, nanny level tutorial
Inter bank transfer business is A typical distributed transaction scenario. Assuming that A needs inter-bank transfer to B, the data of two banks are involved. The ACID of transfer cannot be guaranteed through the local transaction of one database, but can only be solved through distributed transactions.
Distributed transaction
Distributed tr ...
Added by todding01 on Tue, 21 Dec 2021 14:21:24 +0200
Distributed transaction practice in microservices
background
With the rapid development of business and the increasing complexity of business, microservice, as one of the best solutions, decouples services, reduces complexity and increases maintainability, but also brings some new problems.
When we need to ensure data consistency across services, the original database transaction is unable t ...
Added by dserf on Tue, 21 Dec 2021 05:56:00 +0200
[Go advanced] how to make your Go Project Log clear and interesting - Zap log Library
This paper first introduces the use of the native log Library of Go language, then introduces the very popular open source zap log Library of Uber in detail, and introduces how to cut and archive logs with Lumberjack.
Use of Zap log Library in Go language project
In many Go language projects, we need a good logger that can provide the ...
Added by ShootingBlanks on Mon, 20 Dec 2021 23:22:48 +0200
Go study notes
preface
Begin to learn Chapter 10 structure and method. This is the learning notes of the Go getting started guide.
Structure definition
type identifier struct {
field1 type1
field2 type2
...
}
package main
import "fmt"
type point struct {
x float64
y float64
}
func main() {
var p1 point
p1.x = 5
p1.y = 5
fmt.Println(p ...
Added by porto88 on Mon, 20 Dec 2021 17:51:27 +0200
[Go memory allocation]
The running of programs requires memory, such as variable creation, function call, data calculation and so on. So when you need memory, you need to apply for memory and allocate memory. In languages such as C/C + +, the memory is managed by the developers themselves and needs to be actively applied and released, while in Go language, it is mana ...
Added by barney0o0 on Mon, 20 Dec 2021 17:08:59 +0200
Go bottom layer - Reflection and interface ②
Ten problems about interface of deep decryption Go language (I)
The relationship between Go language and duck type
Let's look directly at the definition in Wikipedia:
If it looks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck.
Translated as:
If something looks like a duck, swims like a duck, ...
Added by and1c on Mon, 20 Dec 2021 15:19:30 +0200
[Go reflection law, runtime reflection]
During development, there will be many conversions between strings and structures. Especially when calling the API, the JSON string returned by the API needs to be converted into a struct structure for easy operation. So how is a JSON string converted to a struct structure? This requires the knowledge of reflection.
What is reflection?
Like ...
Added by Appletalk on Mon, 20 Dec 2021 05:30:58 +0200
Go language package and go tools
introduction
Go comes with more than 100 packages, which can provide the foundation for most applications. Go community is a thriving ecological environment that encourages package design, sharing, reuse and improvement. Many packages that have been released can be found in https://godoc.org Found.
The purpose of package management system is ...
Added by idweb on Mon, 20 Dec 2021 00:07:09 +0200
Beginners learn the basics of go -- the principle of Slice slice
preface
This paper mainly records: 1. Implementation principle of slice slice. 2. Whether the slice pointer is stored in the heap or stack. 3. Some pits in slicing.
1, Why slices?
Because the array in go is of value type, it is of fixed size when used. For example, the length of the array cannot be changed after arr: = [3] int {1,2, ...
Added by tkreinbring on Sun, 19 Dec 2021 17:52:54 +0200
Advanced use of embedded C language (the most detailed in the whole network)
Advanced use of embedded C language (the most detailed in the whole network)
1, Macro
Macro, in my opinion, is a major feature of C language. On this basis, some special functions can be used.
1.1 variable type parameter macro
In some application scenarios, we often need to find the maximum and minimum values similar to the two. We often ...
Added by kippy on Sat, 18 Dec 2021 17:12:31 +0200