[golang] leetcode Beginner - verify binary search tree & symmetric binary tree
The first question is to verify the binary search treeTopic informationProblem solving ideasAll left and right subtrees themselves must also be binary search trees. Obviously, this can be solved recursivelyWe only need to verify that the value of the root node is greater than the value of all left subtrees and less than the value of all right s ...
Posted by DocSeuss on Thu, 27 Jan 2022 20:22:11 +0100
Golang slice uses Daquan (create, initialize, traverse, intercept, modify, add, copy of slice, slice as function parameter, slice sum, slice maximum)
Concept:
The length of the slice is not fixed and data can be added. It is similar to the concept of dynamic array in Java. The reason for the emergence of the slice is also that the operability of the array is not high.
Dynamic initialization of array:
Array dynamic initialization is to give only the length of the array and the defa ...
Posted by waynem801 on Thu, 27 Jan 2022 12:48:21 +0100
golang learning notes sorting
Basic part of golang:
Go cannot download and install git plug-in because the ip address of go agent cannot be accessed. You can change the following address:
Proxy is used by default golang. Org, not accessible at home
go>go get -u github.com/go-sql-driver/mysql
go>go env -w GOPROXY=https://goproxy.cn
goweb part:
Four link ...
Posted by dgrinberg on Thu, 27 Jan 2022 12:33:50 +0100
Golang wails2 lightweight cross desktop solution
wails2
github: github.com/wailsapp/wails
file: wails.io/zh-Hans/docs/reference/op...
Environmental requirements
Go 1.16 npmIt must be one of Windows, MacOS and Linux operating systemsgcc
install
# Go 1.17 lower installation
go install github.com/wailsapp/wails/cmd/wails@latest
# Go 1.16
$ go get -u github.com/wailsapp/wails/cmd/wails
Ent ...
Posted by towerspl on Thu, 27 Jan 2022 09:19:32 +0100
GoLang design pattern 16 - template method pattern
Template method design pattern is a behavioral design pattern. This pattern is commonly used to define a template or algorithm model for a specific operation.
Take OTP (One Time Password) as an example. There are two common one-time passwords: SMS password (SMS OTP) or email password (Email OTP). However, the processing steps of both SMS passw ...
Posted by Isomerizer on Thu, 27 Jan 2022 07:35:56 +0100
Using Zap log Library in Go language project
Using Zap log Library in Go language project
The use of the native log Library of Go language, and then introduces the very popular open source zap log Library of Uber in detail. At the same time, it introduces how to cooperate with Lumberjack to realize log cutting and archiving.
1, Using Zap log Library in Go language project
introduce
In man ...
Posted by ntlab on Thu, 27 Jan 2022 05:50:10 +0100
GoLang design pattern 04 - singleton pattern
Singleton pattern is probably the most well-known design pattern. It is also a kind of creative mode. We will use this design pattern when only one instance of a struct is allowed. The only instance of this struct is called a singleton object. Here are some scenarios where you need to create a singleton object:
Database instance: generally, in ...
Posted by kellog on Thu, 27 Jan 2022 04:26:42 +0100
Vi-4: timer
1, Design principle
The timer of Go language has experienced many version iterations
Before go version 1.9, globally unique quadheap maintenance was usedGo 1.10-1.13 uses 64 Quad heaps globally, and each processor (P) corresponds to one Quad heapAfter Go 1.14, each processor P directly manages a quad heap, which is triggered by the network po ...
Posted by Joseph Sliker on Thu, 27 Jan 2022 03:26:19 +0100
Take you ten days to easily handle the Go micro service series (VIII. Service monitoring)
preface
We will show you a go zero micro service example in detail through a series of articles. The whole series is divided into ten articles, and the directory structure is as follows:
Environment constructionService splittingUser servicesProduct serviceOrder servicePayment servicesRPC service Auth authenticationService monitoring (this art ...
Posted by academ1c on Wed, 26 Jan 2022 17:14:27 +0100
How to implement a simple producer consumer model in Go language?
The article comes from WeChat official account: Go language circle.
1, Producer consumer model
Producer consumer model: a module (function, etc.) is responsible for generating data, which is processed by another module (the module here is generalized and can be class, function, collaboration, thread, process, etc.). The module that generates ...
Posted by Gordicron on Tue, 25 Jan 2022 09:00:22 +0100