Coprocess swoole vs. golang

COOPERATION CONCEPT Coroutines are a lighter existence than threads, just as a process can have multiple threads, a thread can have multiple threads. A collaboration has the following characteristics User-state execution, completely controlled by the program, not managed by the operating system kernel Suitable for handling IO-intensive task ...

Posted on Fri, 05 Jun 2020 10:07:33 -0700 by dvidunis

GO uses Webhook to automate github deployment

Usually most of your development is submitted by local git push, and git pull is updated manually on the server.Git can be deployed automatically using a webhook.A webhook is a hook event for a warehouse platform that listens for code and calls back notifications (the notification address is the webhook address you fill out in each git warehous ...

Posted on Sun, 24 May 2020 09:52:58 -0700 by Joost

Golang reflect usage guide

Go s provide features such as variables, slices, structs, and so on, which can be easily defined and used.For example, when you want to define the type of a structure, simply define: type A struct { Name string } However, when it comes to processing dynamic data structures, we don't know the structure of unknown data at the compilation stage ...

Posted on Tue, 05 May 2020 10:41:26 -0700 by nocturne

Gin go learning Note 6: preparation of gin web framework Api

Api writing 1> The data formats returned by the Api of the Gin framework are JSON, XML and yaml. Yaml is a special data format. (I haven't implemented the operation of getting nodes for the time being.) 2> In the apis folder, create a new data.go file as the business logic code to obtain api data. The specific code is as follows:     pac ...

Posted on Mon, 04 May 2020 04:14:13 -0700 by Levan

Gin go learning note 3: JS paging of gin Web Framework

JS paging 1> JS paging, business logic (1) Paging uses a jQuery plug-in called jquery.pagination.js (2) The support of jquery is required. jquery-2.1.1.min.js is used in this project (3) The parameters required for paging are: total number of records, number of displays per page, and page number (4) Add search criteria to use as a query 2&gt ...

Posted on Fri, 01 May 2020 21:04:02 -0700 by saurabhdutta

gorm series - create record and field defaults

Catalog Gorm create record and field defaults Establish Default Using pointer to save zero value into database Using Scanner/Valuer interface to store zero value into database Gorm create record and field defaults CRUD usually refers to the operation of adding, deleting, modifying and querying the database Establish package main import ( ...

Posted on Mon, 27 Apr 2020 08:46:32 -0700 by Vasko

gorm series - query

Catalog Gorm query General query where condition Normal SQL query Touch & map query Not condition Or condition Inline conditions Additional Query options FirstOrInit Attrs Assign FirstOrCreate Attrs Assign Advanced query Subquery Select field sort Number deviation Total Group & Having Connect Pluck scanning Chain opera ...

Posted on Mon, 27 Apr 2020 02:44:21 -0700 by jklanka

gin series Middleware

The Gin framework allows developers to add the user's own Hook function in the process of processing requests. This Hook function is called middleware, which is suitable for handling some common business logic, such as login authentication, permission verification, data paging, logging, time-consuming statistics, etc Define Middleware Middlewar ...

Posted on Tue, 21 Apr 2020 07:21:23 -0700 by xfezz

Deeply decrypt sync.Pool for Go Language

Recently, you have encountered a problem with GC in your work: a lot of objects are created repeatedly in your project, causing a huge amount of GC work and frequent CPU dropouts.Prepare to use sync.Pool to cache objects and reduce GC consumption.In order to make it easier to use, I specially studied it to form this article.This article from th ...

Posted on Sun, 19 Apr 2020 19:43:34 -0700 by tshafer

go function learning notes

What is a function Code block with input and output to perform specific functions func functionnname([partmeternam type]) [return type] {   // function body } Several types of functions Function with no parameter return value Function with parameter return value defer statement 1. Function with no parameter return value package main impo ...

Posted on Fri, 17 Apr 2020 07:11:22 -0700 by 00Sven