Logo ByteGopher
Logo Inverted Logo
  • Posts
  • Blog
  • CloudNative
  • Infrastructure
    • TimeSeriesDB
  • Kubernetes
  • Note C
  • Note Go
  • React
  • Tips
  • Nodus
  • Interview
  • Life
  • Linux
Hero Image
2021-03-16

Golang 同时定义多个相关的struct, 这样写可读性更好一些 1type ( 2 // item defines the fields associated with the item tag 3 // in the rss document. 4 item struct { 5 XMLName xml.Name `xml:"item"` 6 PubDate string `xml:"pubDate"` 7 Title string `xml:"title"` 8 Description string `xml:"description"` 9 Link string `xml:"link"` 10 GUID string `xml:"guid"` 11 GeoRssPoint string `xml:"georss:point"` 12 } 13 14 // image defines the fields associated with the image tag 15 // in the rss document.

January 1, 0001 Read
Hero Image
2021-03-17

Golang 1// A map of registered matchers for searching. 2var matchers = make(map[string]Matcher) 3 4// Run performs the search logic. 5func Run(searchTerm string) { 6 // Retrieve the list of feeds to search through. 7 feeds, err := RetrieveFeeds() 8 if err != nil { 9 log.Fatal(err) 10 } 11 12 // Create an unbuffered channel to receive match results to display. 13 results := make(chan *Result) 14 15 // Setup a wait group so we can process all the feeds.

January 1, 0001 Read
Hero Image
2021-03-xx

Golang

January 1, 0001 Read
Hero Image
2021-04-20

Flush 清空缓冲区 首先,咱们设想要给鱼缸换水,所以需要一个水泵,水泵是连接鱼缸和下水道的,咱们的任务就是将鱼缸里面水全抽干,这时,我们就可以把水管当做缓冲区。如果咱们一见鱼缸里面水抽干了就立马关了水泵,这时会发现水管里还有来不及通过水泵流向下水道的残留水,我们可以把抽水当做读数据,排水当做写数据,水管当做缓冲区,这样就容易明白了。 那么这样一来我们如果中途调用close()方法,输出区也还是有数据的,就像水缸里有水,只是在缓冲区遗留了一部分,这时如果我们先调用flush()方法,就会强制把数据输出,缓存区就清空了,最后再关闭读写流调用close()就完成了。 缓冲区可以简单地理解为一段内存区域。可以简单地把缓冲区理解为一段特殊的内存。某些情况下,如果一个程序频繁地操作一个资源(如文件或数据库),则性能会很低,此时为了提升性能,就可以将一部分数据暂时读入到内存的一块区域之中,以后直接从此区域中读取数据即可,因为读取内存速度会比较快,这样可以提升程序的性能。 https://blog.csdn.net/qq_38129062/article/details/87115620

January 1, 0001 Read
Hero Image
2021-04-21

Flush 清空缓冲区 首先,咱们设想要给鱼缸换水,所以需要一个水泵,水泵是连接鱼缸和下水道的,咱们的任务就是将鱼缸里面水全抽干,这时,我们就可以把水管当做缓冲区。如果咱们一见鱼缸里面水抽干了就立马关了水泵,这时会发现水管里还有来不及通过水泵流向下水道的残留水,我们可以把抽水当做读数据,排水当做写数据,水管当做缓冲区,这样就容易明白了。 那么这样一来我们如果中途调用close()方法,输出区也还是有数据的,就像水缸里有水,只是在缓冲区遗留了一部分,这时如果我们先调用flush()方法,就会强制把数据输出,缓存区就清空了,最后再关闭读写流调用close()就完成了。 缓冲区可以简单地理解为一段内存区域。可以简单地把缓冲区理解为一段特殊的内存。某些情况下,如果一个程序频繁地操作一个资源(如文件或数据库),则性能会很低,此时为了提升性能,就可以将一部分数据暂时读入到内存的一块区域之中,以后直接从此区域中读取数据即可,因为读取内存速度会比较快,这样可以提升程序的性能。 https://blog.csdn.net/qq_38129062/article/details/87115620

January 1, 0001 Read
Hero Image
2021-05-20

1package main 2 3import "fmt" 4 5var testMap = map[string]map[string]struct { 6 Name string 7}{ 8 "first": {"second": {Name: "12312"}}, 9 "second": {"second": {"12312"}}, 10} 11 12func main() { 13 d := testMap["first"]["second"].Name 14 fmt.Printf("++-%v-++\n", d) 15 16 17 // map 不会报 nil 18 c := testMap["first22"]["second"].Name 19 fmt.Printf("++-%v-++\n", c) 20} 结果 1++-12312-++ 2++--++

January 1, 0001 Read
Hero Image
2021-05-26

rwarestse ewartawe -gcflags=-l 1. 线上的配置文件写在了哪里 1GOMAXPROCS = 8 2TSDB_HOST = bytetsd-query-server-prod-ppe-va.byted.org 3 4 5# influxdb 配置 本地如何调试 一些特殊的token的解析 NaNAsZero, not_sliteral_or, nullAsZero 是否还可以rebase bosun开源版本 ui fenbu cs Trace bytetrace expr (context) trace 对齐其他语言的框架, 例如ginex context state –> context inf.bytesd.bosun Log slog Error errors 业务状态码 err 静态 非200 5001 执行失败,动态参数解析失败, duration, 计算错误 5002 runtime panic 5003 panic string 对齐trace 新加的一些函数 funcs.go pprof 8071

January 1, 0001 Read
Hero Image
2021-05-26

rwarestse ewartawe -gcflags=-l 1. 线上的配置文件写在了哪里 1GOMAXPROCS = 8 2TSDB_HOST = bytetsd-query-server-prod-ppe-va.byted.org 3 4 5# influxdb 配置 本地如何调试 一些特殊的token的解析 NaNAsZero, not_sliteral_or, nullAsZero 是否还可以rebase bosun开源版本 ui fenbu ssssTrace bytetrace expr (context) trace 对齐其他语言的框架, 例如ginex context state –> context inf.bytesd.bosun Log slog Error errors 业务状态码 err 静态 非200 5001 执行失败,动态参数解析失败, duration, 计算错误 5002 runtime panic 5003 panic string 对齐trace 新加的一些函数 funcs.go pprof 8071

January 1, 0001 Read
Hero Image
2021-06-01

sync.pool

January 1, 0001 Read
  • ««
  • «
  • 3
  • 4
  • 5
  • 6
  • 7
  • »
  • »»
Navigation
  • About
  • Skills
  • Recent Posts
  • My Story
Contact me:
  • renqiqiang@outlook.com

Stay up to date with email notification

By entering your email address, you agree to receive the newsletter of this website.

Toha Theme Logo Toha
© 2020-2022 Copyright.
Powered by Hugo Logo