[Go] use Go to access MySQL

Access MySQL with Go The database/sql package of Go language provides a general interface to connect SQL databases or SQL like databases, but does not provide specific database drivers. When using it, at least one database driver must be injected. Implement basic CRUD 1. Create database and database tables Enter the database cmd through th ...

Added by JeditL on Fri, 28 Jan 2022 16:48:47 +0200

Take you ten days to easily handle the Go micro service series

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 construction Service splitting User services Product service Order service Payment service (this article) RPC service Auth authentication Service ...

Added by drumhrd on Fri, 28 Jan 2022 15:48:49 +0200

Implementation principle of defer in GO

[TOC] Implementation principle of defer in GO Let's review our last sharing and share some knowledge about channels What is the channel in GODetailed analysis of the underlying data structure of the channelHow is the channel implemented in the GO source codeBasic principles of Chan reading and writingWhat exceptions will occur when the chann ...

Added by flunn on Fri, 28 Jan 2022 07:26:17 +0200

Command line program of Go language

Programmers want to create command-line programs for the following reasons: 1. Create scripts for that can be run automatically on a regular basis. 2. To create a script that interacts with files in the system. 3. To create scripts that can perform system maintenance tasks. 4. To avoid the unnecessary overhead of designing graphical user in ...

Added by SoberDude on Thu, 27 Jan 2022 20:24:08 +0200

Efficient GO programming - code comments

More free Golang knowledge, welcome to join Go Baodian | GOLANG ROADMAP Invitation code: Gopher-1035-0722 Go language supports C-style block annotation / * * / and C + + style line annotation / /. Line comments are more commonly used, while block comments are mainly used as package comments. Of course, they can also be used when a large piece ...

Added by milesap on Thu, 27 Jan 2022 16:39:02 +0200

go language learning [2]

Go language basic data types I Variables and their related contents II Integer type III Floating point type IV Character type V Boolean type Vi String type VII Mutual conversion of basic data types VIII Pointer I Variables and their related contents 1. Use steps of variables: (1) Declare variables (define variables) (2) Assignment (3) Use ...

Added by Ganlek on Thu, 27 Jan 2022 05:05:13 +0200

Go code specification sorting

Go Code Review Summarize several code specification errors that are often made in the development process Reference link: https://learnku.com/go/wikis/48375 Comment statement // Request indicates the request to run the command. type Request struct { ... // Encode writes the JSON encoding of req to w. func Encode(w io.Writer, req *Request) { ...

Added by mcdsoftware on Thu, 27 Jan 2022 02:37:53 +0200

Develop blockchain applications from zero -- get gin framework parameters

1, Get query parameters Query refers to the URL? Parameters carried later, such as user/info?username = Zhang San & password = 123. The method to obtain the requested query parameters is as follows: When using DefaultQuery, if the username entered by the browser is not obtained, the default value will be returned username := ctx.DefaultQ ...

Added by Hiro on Wed, 26 Jan 2022 22:05:47 +0200

Using Air to realize real-time thermal overload of Go program

Today, we will introduce an artifact - Air, which can monitor the code file of the project in real time and automatically recompile and execute after the code changes, which greatly improves the development efficiency of gin framework project. Why do I need to load in real time? When writing Web projects in Python, the common Flask or Django fr ...

Added by lightningstrike on Wed, 26 Jan 2022 17:43:47 +0200

go Bible notes - Introduction

Configure the idea environment (go version 1.17.1) and learn according to the go language Bible directory. Hello, World package main import "fmt" func main() { /* This is my first simple program */ fmt.Println("Hello, World!") } Go is a compiled language. The tool chain of go language converts the source code and its dependencies ...

Added by khurramijaz on Tue, 25 Jan 2022 19:45:24 +0200