Dependency Injection Using google/wire

Wire Use Tutorial Wire is a tool provided by Google to help Google developers implement compile-time dependency injection.Learn to use Wire through examples.Here's a small welcome program to learn how to use Wire. The first step in building a welcome program Let's create a applet that simulates an event with a greeting for a welcome guest with ...

Posted by dylan001 on Sat, 09 Nov 2019 01:10:34 -0800

Using etcd to realize service registration and discovery

The basic functions of service registration and discovery in the system are as follows Service registration: all nodes of the same service are registered in the same directory. After the node is started, its information is registered in the directory of the service. Health check: the service node sends the heartbeat regularly, sets a shorter T ...

Posted by hofmann777 on Thu, 07 Nov 2019 22:09:54 -0800

The golang cli command line framework uses

brief introductionCli provides simple and fast development of command line functions.Setting parameters and configurations by command is a basic requirement in applications.Cli can help you quickly build command line functionality. install go get github.com/urfave/cli Simple example package main import ( "fmt" "os" "github.com/ur ...

Posted by JNettles on Thu, 07 Nov 2019 06:19:48 -0800

Try Facebook library, can bitcoin get on this train

White paper highlights Before starting to play the library test network, draw the key points in the library white paper, such as how to generate coins, how to trade, etc. Building a simple, borderless currency and financial infrastructure for billions of people The effect is, for example, if you want to go to the United States and need to order ...

Posted by greenday on Wed, 06 Nov 2019 03:09:25 -0800

go language data structure and algorithm library GoSTL

GoSTL GoSTL is a go language data structure and algorithm library, similar to C + + STL, but more powerful. Combined with the characteristics of go language, most of the data structures have realized thread safety. When creating objects, you can specify whether to turn it on through configuration parameters. Function list data structure slic ...

Posted by beemzet on Tue, 05 Nov 2019 00:17:40 -0800

go language defragmentation time

Time and date are often used in our programming. This paper mainly introduces the basic usage of time package built in Go language. Import package in Go language Single line import import "time" import "fmt" Multi line import import ( "fmt" "time" ) time package The time.Time type represents time. func main(){ now := time.Now() ...

Posted by sandrine2411 on Sun, 03 Nov 2019 16:27:47 -0800

The pit of gorm associated query

Background: Recently, I am learning golang, trying to rewrite the previous PHP project with go.The table models involved are as follows: // Article type Topics struct { Id int `gorm:"primary_key"` Title string `gorm:"not null"` Body string `gorm:"not null"` UserId int `gorm:"not n ...

Posted by morphy on Sun, 03 Nov 2019 02:32:43 -0800

Slice of GO Foundation

What is slicing Go language slicing is an abstraction of arrays. The length of go array cannot be changed, so such a set is not suitable in a specific scene. Go provides a flexible and powerful built-in type slice ("dynamic array"); Compared with array, the length of slice is not fixed. You can append elements, which may increase ...

Posted by Lodar on Sat, 02 Nov 2019 14:29:05 -0700

go map data structure and source code details

Catalog 1. Preface 2. Data structure of go map 2.1 core nodule 2.2 data structure chart 3. Common operations of go map 3.1 create 3.2 insert or update 3.3 delete 3.4 search 3.5 range iteration 3.5.1 initialize iterator mapiterinit() 3.5.2 iterative p ...

Posted by Dysan on Sat, 02 Nov 2019 08:08:51 -0700

go language time / timestamp operation

basic operation 01: get current time dateTime := time.Now() fmt.Println(dateTime) 02: get month day hour minute second nanosecond year := time.Now().Year() //year fmt.Println(year) month := time.Now().Month() //month fmt.Println(month) day := time.Now().Day() //day fmt.Println(day) hour := time.Now().Hour() //hour fmt.Println(hour) minute ...

Posted by djpeterlewis on Thu, 31 Oct 2019 03:52:56 -0700