ZhangZhihui's Blog  

2024年6月11日

摘要: package main import ( "database/sql" "fmt" "os" _ "github.com/mattn/go-sqlite3" ) func main() { // Connect or create a SQLite database db, err := sql. 阅读全文
posted @ 2024-06-11 20:02 ZhangZhihuiAAA 阅读(4) 评论(0) 推荐(0) 编辑
 
摘要: If there are multiple init() functions in a package, don't use in an init() function a global variable that is initialized in another init() function, 阅读全文
posted @ 2024-06-11 19:47 ZhangZhihuiAAA 阅读(4) 评论(0) 推荐(0) 编辑
 
摘要: Remember that the biggest advantage you get from using a map[string]interface{} map, or any map that stores an interface{} value in general, is that y 阅读全文
posted @ 2024-06-11 19:27 ZhangZhihuiAAA 阅读(5) 评论(0) 推荐(0) 编辑
 
摘要: package main import ( "fmt" "reflect" ) type Secret struct { Username string Password string } type Record struct { Field1 string Field2 float64 Field 阅读全文
posted @ 2024-06-11 17:07 ZhangZhihuiAAA 阅读(4) 评论(0) 推荐(0) 编辑
 
摘要: package main import ( "fmt" "maps" ) func delete(k string, v int) bool { return v%2 != 0 } func equal(v1 int, v2 float64) bool { return float64(v1) == 阅读全文
posted @ 2024-06-11 11:35 ZhangZhihuiAAA 阅读(12) 评论(0) 推荐(0) 编辑
 
摘要: package main import ( "fmt" "slices" ) func main() { s1 := []int{1, 2, -1, -2} s2 := slices.Clone(s1) fmt.Printf("%p\n", s1) fmt.Printf("%p\n", s2) s1 阅读全文
posted @ 2024-06-11 11:22 ZhangZhihuiAAA 阅读(5) 评论(0) 推荐(0) 编辑
 
摘要: 阅读全文
posted @ 2024-06-11 10:12 ZhangZhihuiAAA 阅读(5) 评论(0) 推荐(0) 编辑