ZhangZhihui's Blog  
上一页 1 ··· 97 98 99 100 101 102 103 104 105 ··· 116 下一页

2023年10月5日

摘要: Problem: You want to decode the customized binary format back to structs. Solution: Use the encoding/binary package to take data from the binary forma 阅读全文
posted @ 2023-10-05 10:24 ZhangZhihuiAAA 阅读(17) 评论(0) 推荐(0)
 
摘要: Problem: You want to encode struct data to a customized binary format. Solution: Design your customized format and use the encoding/binary package to 阅读全文
posted @ 2023-10-05 10:13 ZhangZhihuiAAA 阅读(48) 评论(0) 推荐(0)
 
摘要: Problem: You want to decode gob format data back to structs. Solution: Use the encoding/gob package to decode the gob format data back to structs. fun 阅读全文
posted @ 2023-10-05 09:51 ZhangZhihuiAAA 阅读(20) 评论(0) 推荐(0)
 
摘要: Problem: You want to encode structs into binary gob format. Solution: Use the encoding/gob package to encode the structs into bytes that can be stored 阅读全文
posted @ 2023-10-05 09:44 ZhangZhihuiAAA 阅读(23) 评论(0) 推荐(0)

2023年10月3日

摘要: Problem: You want to create streaming JSON data from structs. Solution: Create an encoder using NewEncoder in the encoding/json package, passing it an 阅读全文
posted @ 2023-10-03 11:51 ZhangZhihuiAAA 阅读(18) 评论(0) 推荐(0)
 
摘要: Problem: You want to create JSON data from a struct. Solution: Create the structs then use the json.Marshal or json.MarshalIndent to marshal the data 阅读全文
posted @ 2023-10-03 11:42 ZhangZhihuiAAA 阅读(17) 评论(0) 推荐(0)
 
摘要: Problem: You want to parse JSON data from a stream. Solution: Create structs to contain the JSON data. Create a decoder using NewDecoder in the encodi 阅读全文
posted @ 2023-10-03 11:23 ZhangZhihuiAAA 阅读(29) 评论(0) 推荐(0)

2023年10月1日

摘要: Using io.Copy is about twice as fast and uses only a fraction (less than 1%) of the memory. With really large files, if you’re using the io.ReadAll an 阅读全文
posted @ 2023-10-01 20:20 ZhangZhihuiAAA 阅读(37) 评论(0) 推荐(0)

2023年9月30日

摘要: package main import "fmt" func adder() func(int) int { sum := 0 return func(x int) int { sum += x return sum } } func main() { pos, neg := adder(), ad 阅读全文
posted @ 2023-09-30 10:14 ZhangZhihuiAAA 阅读(23) 评论(0) 推荐(0)
 
摘要: Problem: You want to log in to the system log instead of your logfiles. Solution: Use the log/syslog package to write to syslog. Syslog is a standard 阅读全文
posted @ 2023-09-30 08:20 ZhangZhihuiAAA 阅读(47) 评论(0) 推荐(0)
上一页 1 ··· 97 98 99 100 101 102 103 104 105 ··· 116 下一页