golang ent 建立 MySQL 连接池

Jackey Golang 2,635 次浏览 0 评论 , ,
安装 ent 包 go install entgo.io/ent/cmd/ent@latest 生成初始化代码 在项目根目录创建目录:ent/schema 在schema目录创建空表代码文件 DrData.go: type DrData struct { ent.Schema } // Fiel...

mac 使用 python 命令执行 python3

Jackey Python 2,727 次浏览 0 评论
测试机系统版本:Mac 12.6.6 前因: 因新的Mac系统移除了 python2,系统中只有 python3,但是 python3 必须使用 python3 指令才能执行,而对于部分工具如果调用python,只是执行python命令,系统中没有pyth...

Golang logrus 自定义日志格式

Jackey Golang 5,214 次浏览 0 评论 , ,
logrus 仓库地址:https://github.com/sirupsen/logrus 实现代码: func init() { // 配置日志格式 logrus.SetReportCaller(true) logrus.SetFormatter(&MyFormatter{}) logrus.SetL...

JavaScript 日期格式化方法

Jackey 其他 2,959 次浏览 0 评论 ,
function format(date, format = "yyyy-MM-dd hh:mm:ss") { //new Date 在 ios safari浏览器有兼容性问题处理如下: // ? 兼容safari : 兼容其他浏览器 let $this = new Date(date) == 'Invalid D...

python 类提供的魔术方法

Jackey Python 3,018 次浏览 0 评论 ,
table, td{ border: 1px solid #000000; border-collapse: collapse; line-height:40px; } 魔法方法 含义 基本的魔法方法 __new__(cls[, ...]) 1. __new__ ...

Golang websocket 客户端

Jackey Golang 2,732 次浏览 0 评论 ,
基于:github.com/gorilla/websocket 实现 func main() { interrupt := make(chan os.Signal, 1) signal.Notify(interrupt, os.Interrupt) ws := "ws://127.0.0.1:8080/ws" c, _, err := ...

Golang etcd ClientV3 的使用

Jackey Golang 2,678 次浏览 0 评论 ,
etcdctl基本使用 增加一条数据 etcdctl put "/school/class/name" "helios" 获取一条数据 etcdctl get "/school/class/name" 得到一组数据 etcdctl get "/school/class/" --prefix 得到所有的ke...

HTTP 报文解析

Jackey Golang 2,776 次浏览 0 评论 ,
获取请求报文 请求报文格式说明 HTTP请求报文由请求行、请求头、空行、请求体四个部分组成,如下图:   请求行 请求行由方法字段和HTTP协议版本字段3个部分组成,他们呢之间使用空格隔开。...
Go