Tag:golang

  • Introduction and Use of httptest

    Time:2019-8-24

    After the interface is written, it needs to be tested and provided in the golang standard library.httptestPackage to assist in testing. Because all interfaces need IP addresses or domain names to access.httptestService addresses are defined by default in packages const DefaultRemoteAddr = “1.2.3.4” Important methods New Request NewRequestMethod is used to create an HTTP request […]

  • Analysis of the Implementation Principle of Go Channel

    Time:2019-8-23

    Channel is a type of pipeline through which messages can be sent and received between goroutines. It is the way Golang provides communication between goroutines at the language level. As we all know, Go relies on a concurrent model called CSP (Communicating Sequential Processes) to implement this synchronization mode through Channel. The core philosophy of […]

  • Go grabs web data and stores it in MySQL and returns JSON data

    Time:2019-8-22

    Preface Want to learn long agoGOHowever, due to preparation for postgraduate study and internship, it has been delayed to start, only occasionally look at the relevant basic grammar, and did not specifically apply it to the actual coding. When I was a senior, the course was much less, so I decided to use it to […]

  • Interesting, 5.20 Use Go to make an illustration / Let words dance

    Time:2019-8-22

    Today I’m going to introduce you to an interesting piece of code.Generate pictures into textual patterns. Have you seen the GIF of the dancing girls in station B? With this code, you can make it yourself. GIF I am too lazy to do, as a back-end programmer, not too patient frame by frame screenshots, you […]

  • Go grabs web data and stores it in MySQL and returns JSON data

    Time:2019-8-21

    The previous section has explained what to do and the directory structure of the entire applet, and then the coding section begins.First introduce the package under the project into the entry filecrawldataThen call the function in which the data is fetched, temporarily namedCrawl: package main import ( “fmt” “indiepic/crawldata” ) func main () { // […]

  • Go Gin Source Learning (V) Cardinal Tree Self-realization

    Time:2019-8-21

    Gin Routing Main Process Implementation After the last learning note, we already know the main process of Gin Router. But we can see that the code and method body are generally very long, and most of them are the judgment of parameter routing. These scattered little logic makes it harder for us to understand the […]

  • Another go command line parameter processor – Cmdr

    Time:2019-8-20

    cmdrIt’s another command line parameter processor (Golang). Golang has itflagsIt’s convenient to process command line parameters, but it’s very unique and anti-human, as Google has always done. In the history of computer human-computer interaction interface, there is only one way of command-line interaction that runs through the whole process and is inherited and continued, that […]

  • Go grabs web data and stores it in MySQL and returns JSON data

    Time:2019-8-20

    In the previous section, we mainly implemented the use of goquery to capture data from the photo website http://www.gratisography.com/. Grabbing Picturesdata-original、width、height、alt、typeFive items of data. So you need to create the database and the corresponding tables first, which I use on the mac.Sequel ProDatabase management software to create a new database after connectionindiepicThen create the tablegratisography: […]

  • Go grabs web data and stores it in MySQL and returns JSON data

    Time:2019-8-19

    In the previous section, the required data has been crawled from the website http://www.gratisography.com/and stored in the database.crawldata.goMediumInsertData(&imageDatas)Function, now you need to take the data from the databaseindiepicTablegratisographyIf you take it out, you will be able to take it out at the same time.jsonData in format. The project folder structure is as follows: indiepic ├── […]

  • Golang library collection

    Time:2019-8-19

    data structure A library that improves business development efficiency by 10 times Gods data structure library tool Front-end Input Data Verification Toolkit Big gift package of resources Big gift package of resources

  • Source code parsing of golang HTTP server

    Time:2019-8-18

    How to use HTTP package Using golang‘s http package, a web service can be easily implemented, as follows main.go package main import ( “log” “net/http” “runtime” “fmt” ) func foo(w http.ResponseWriter, r *http.Request) { w.Write([]byte(“hi! babe~”)) } func echo(w http.ResponseWriter, r *http.Request) { s := fmt.Sprintf(“gorotines count: %d”, runtime.NumGoroutine()) w.Write([]byte(s)) } func main() { mux […]

  • Summary of Block Chain Developer Tutorials, Php/Python/C#/Node/Go

    Time:2019-8-18

    Mixin Network is a free, 1 second confirmed high-speed transfer network. We have written a series of multilingual tutorials that allow developers to build a Bitcoin collection application in 15 minutes. Course PHP Go Node.js C# Python Create a robot to receive and send messages php 1 Go 1 Node.js 1 C# 1 python 1 […]