2021年12月5日
摘要:
英文原版 50 Shades of Go: Traps, Gotchas, and Common Mistakes for New Golang Devs 中文翻译版 *** Golang 新手可能会踩的 50 个坑 1~34初级篇 1、左大括号不能放一行 在其他大多数语言中,{ 的位置你自行决定。
阅读全文
posted @ 2021-12-05 16:24
江湖乄夜雨
阅读(313)
推荐(0)
2021年11月21日
摘要:
概述 go中发生panic的场景: - 数组/切片越界 - 空指针调用。比如访问一个 nil 结构体指针的成员 - 过早关闭 HTTP 响应体 - 除以 0 - 向已经关闭的 channel 发送消息 - 重复关闭 channel - 关闭未初始化的 channel - 未初始化 map。注意访问
阅读全文
posted @ 2021-11-21 19:07
江湖乄夜雨
阅读(1573)
推荐(1)
2021年11月14日
摘要:
错误的赋值方式 package z_others import ( "fmt" "testing" ) type Student struct { Name string Age int Gender string } func GenStudent(stuObj *Student) { s :=
阅读全文
posted @ 2021-11-14 14:27
江湖乄夜雨
阅读(1811)
推荐(0)
2021年10月26日
摘要:
重要的参考资料 GO-PG Golang Postgre ORM *** 这里有详细的关于ORM操作的需求 PostgreSQL client and ORM for Go 自己做的练习 package gp_gp_tests import ( "github.com/go-pg/pg/v10" "
阅读全文
posted @ 2021-10-26 10:33
江湖乄夜雨
阅读(790)
推荐(0)
2021年10月24日
摘要:
Python中重写__new__方法实现 import threading import configs class Util(object): _lock = threading.Lock() def __init__(self, host, port): self.host = host sel
阅读全文
posted @ 2021-10-24 12:13
江湖乄夜雨
阅读(82)
推荐(0)
2021年10月17日
摘要:
PostgreSQL的案例 注意:on conflict do 语法,是在postgresql9.5版本推出的!,之前的版本不兼容!PostgreSQL upsert功能(insert on conflict do)的用法 安装及配置pgcli工具 # brew安装 brew install pgc
阅读全文
posted @ 2021-10-17 10:30
江湖乄夜雨
阅读(1621)
推荐(0)
2021年9月12日
摘要:
package in_optrator import ( "fmt" "github.com/emirpasic/gods/sets/hashset" "testing" ) func TestInOperation(t *testing.T) { // New可以方不同类型的元素 h1 := ha
阅读全文
posted @ 2021-09-12 11:33
江湖乄夜雨
阅读(226)
推荐(0)
2021年9月6日
摘要:
使用第三方模块mapstructure go get github.com/mitchellh/mapstructure ~~~ 带下划线的字段需要特殊处理一下❗️❗️❗️ // 对于带 下划线命名 的变量,需要特殊方法解析 type CurrUser struct { Name string `j
阅读全文
posted @ 2021-09-06 15:23
江湖乄夜雨
阅读(1594)
推荐(0)
2021年6月10日
摘要:
环境及MySQL版本说明 MySQL版本使用的是5.7,MySQL的环境是pull了一个docker镜像run起来的。 问题描述 在创建好的数据库中新建一张表emp2: 然后试图往这张表中的title字段写入中文数据时发生了错误! 具体的SQL语句如下: insert into emp2(num,
阅读全文
posted @ 2021-06-10 19:54
江湖乄夜雨
阅读(909)
推荐(0)
2021年6月9日
摘要:
MySQL左联的操作 postgreSQL左联的操作
阅读全文
posted @ 2021-06-09 21:29
江湖乄夜雨
阅读(485)
推荐(0)