摘要: 工具安装 下载地址:https://github.com/voidint/g/releases 中文文档:https://github.com/voidint/g/blob/master/README_CN.md 常用命令 # 列出当前已安装的golang版本 g ls # 列出所有可安装的gola 阅读全文
posted @ 2024-01-23 09:45 元気田支店长 阅读(254) 评论(0) 推荐(0)
摘要: 下载源码 源码下载地址:https://dev.mysql.com/downloads/mysql/ 找到对应版本进行下载上传至服务器 编译安装 使用cmake命令进行安装 cd mysql-8.0.35 mkdir bld cd bld cmake -DCMAKE_INSTALL_PREFIX=/ 阅读全文
posted @ 2023-12-05 15:46 元気田支店长 阅读(517) 评论(0) 推荐(0)
摘要: 出现问题: 在开发过程中,遇到这样一个问题,GORM Model 如下: type Test struct { ... cloumnType uint8 `gorm:"not null;default:0"` ... } 其中有一个类型字段,数据范围是1-10 所以使用uint8字段来存储,在查询某 阅读全文
posted @ 2023-10-16 11:34 元気田支店长 阅读(819) 评论(0) 推荐(0)
摘要: 注:下面方法已封装扩展包,参考:https://www.cnblogs.com/xingzr/p/18655135 图片上绘制文字 package main import ( "github.com/golang/freetype" "image" "image/draw" "image/png" 阅读全文
posted @ 2023-08-07 16:58 元気田支店长 阅读(835) 评论(0) 推荐(1)
摘要: Go标准库中的context包,提供了goroutine之间的传递信息的机制,信号同步,除此之外还有超时(timeout)和取消(cancel)机制。概括起来,Context可以控制子goroutine的运行,超时控制的方法调用,可以取消的方法调用。 context核心数据结构 Context in 阅读全文
posted @ 2023-06-25 09:56 元気田支店长 阅读(93) 评论(0) 推荐(0)
摘要: golang的协程是没有相互的依赖关系的 package main import ( "fmt" "time" ) func main() { go func() { fmt.Println("此处为父协程") go func() { for { time.Sleep(time.Second * 2 阅读全文
posted @ 2023-06-24 09:54 元気田支店长 阅读(584) 评论(0) 推荐(0)
摘要: 最近做项目用到翻译功能,对接了一下科大讯飞的翻译api接口,demo如下: package main import ( "crypto/hmac" "crypto/sha256" "encoding/base64" "encoding/json" "fmt" "io/ioutil" "net/htt 阅读全文
posted @ 2023-05-24 13:17 元気田支店长 阅读(266) 评论(0) 推荐(0)
摘要: 简介 ants是一个高性能的 goroutine 池,实现了对大规模 goroutine 的调度管理、goroutine 复用,允许使用者在开发并发程序的时候限制 goroutine 数量,复用资源,达到更高效执行任务的效果。goroutine相比于线程来说,有着更轻量、资源占用更少、切换速度更快、 阅读全文
posted @ 2023-05-15 15:27 元気田支店长 阅读(660) 评论(0) 推荐(0)
摘要: github.com/unidoc/unioffice 该扩展包对word操作功能比较全,但为商业使用,注册后有100次的试用,具体使用就不详细说明了,具体可以看 https://github.com/unidoc/unioffice-examples github.com/carmel/gooxm 阅读全文
posted @ 2023-05-04 13:16 元気田支店长 阅读(5853) 评论(0) 推荐(2)
摘要: 硬盘使用情况 df -lh 查询当前目录下所有文件的大小 du -sh * 查看内存占用 free -mh cat /proc/meminfo Mem: 内存的使用信息 Swap: 交换空间的使用信息 total:总计物理内存的大小。 used:已使用物理内存。 free:可用物理内存。 share 阅读全文
posted @ 2023-04-28 10:34 元気田支店长 阅读(57) 评论(0) 推荐(0)