作者文章归档:陈海峰

[ PGsql ]


为什么PostgreSQL的回滚是瞬间完成的?

pg数据库的回滚是瞬间完成的。看到这句话是不是觉得pg很先进,确实是这样,但是也是有代价的,下面聊一聊这个问题。
事务的回滚和数据库的MVCC机制是分不开的,先看看以oracle和mysql为代表的基于undo表空间实现的mvcc。 以mysql为例,mysql undo两个最重要的功能,一个是实现了写不阻塞读,或者说是mvcc,另外一个当然就是事务的回滚。
MySQL在进行数据操作时,先将数据备份到undo段中,然后再进行数据的修改,这样未提交的数据会保存一份前镜像在undo中,同时数据行上的rollpointer指针指向undo段上的老数据

< Read more >

[ vscode插件REST CLIENT ]


VSCODE类似postman的请求插件

api.http

@host = 127.0.0.1
@port = 8001
@token = d2f8876850f9ddd904f8653466aa980e6433c7fe
@baseUrl = http://{{host}}:{{port}}

### 1. stock_item全部数据获取 
# @name login
GET {{baseUrl}}/api/stock/get_stock_item_with_num_of_child/ HTTP/1.1
content-type: application/json
Authorization

< Read more >

[ go使用pdf ]


gopdf gopdf is a simple library for generating PDF document written in Go lang.

A minimum version of Go 1.13 is required.

Features Unicode subfont embedding. (Chinese, Japanese, Korean, etc.) Draw line, oval, rect, curve Draw image ( jpg, png ) Set image mask Password protection Font kerning Install

< Read more >

[ golang使用excel ]


golang中使用excel并使用http返回

下载

github.com/xuri/excelize/v2

文档

按列赋值

func (f *File) SetSheetCol(sheet, cell string, slice interface{}) error

根据给定的工作表名称、起始坐标和 slice 类型引用按列赋值。例如,在名为 Sheet1 的工作表 B 列上,以 B6 单元格作为起始坐标按列赋值:

err := f.SetSheetCol("Sheet1", "B6", &[]interface{}{"1&quo

< Read more >