02 2023 档案

摘要:三次握手 客户端回合-第一次握手 SYN=1 (同步标志, Synchronize) seq=x 服务器回合-第二次握手 SYN=1 ACK=1 (确认标志, Acknowledgement) ack=x+1 (Acknowledgement Number,收到的序号+1,下一个预期的序列编号) s 阅读全文
posted @ 2023-02-24 15:35 roadwide 阅读(75) 评论(0) 推荐(0)
摘要:MySQL架构 MySQL分为Sever层和存储引擎层 Server层负责建立连接、分析和执行SQL 连接器、查询缓存、解析器、预处理器、优化器、执行器 内置函数:日期、事件、数学、加密函数 跨存储引擎的功能:存储过程、触发器、视图 存储引擎负责数据的存储和提取 InnoDB(5.5版本开始默认引擎 阅读全文
posted @ 2023-02-23 21:26 roadwide 阅读(595) 评论(0) 推荐(0)
摘要:# 客户端回合 **Client Hello** * 客户端使用的TLS版本 * 支持的密码套件**列表** * 随机数(Client Random) # 服务器回合 **Server Hello** * 确认TLS版本号是否支持 * 选择一个密码套件 * 随机数(Server Random) ** 阅读全文
posted @ 2023-02-22 22:20 roadwide 阅读(101) 评论(0) 推荐(0)
摘要:func fib() func() int { var n1, n2 int return func() int { if n1 == 0 && n2 == 0 { n1 = 1 } else { n1, n2 = n2, n1 + n2 } return n2 } } next := fib() 阅读全文
posted @ 2023-02-20 21:21 roadwide 阅读(77) 评论(0) 推荐(0)
摘要:backticks When using backticks (`) to make strings(Raw string literals), backslashes (\) don't have any special meaning and don't mark the beginning o 阅读全文
posted @ 2023-02-20 17:06 roadwide 阅读(211) 评论(0) 推荐(0)
摘要:rune与string The rune type in Go is an alias for int32. Given this underlying int32 type, the rune type holds a signed 32-bit integer value. However, u 阅读全文
posted @ 2023-02-20 11:47 roadwide 阅读(87) 评论(0) 推荐(0)
摘要:常见用法 var ages map[string]int // 只声明不初始化是nil,赋值会panic: assignment to entry in nil map fmt.Println(ages == nil) // "true" fmt.Println(len(ages) == 0) // 阅读全文
posted @ 2023-02-19 22:00 roadwide 阅读(41) 评论(0) 推荐(0)
摘要:常用函数 t, err := time.Parse(layout,date) // time.Time, error t := time.Date(1995,time.September,22,13,0,0,0,time.UTC) formatedTime := t.Format("Mon, 01/ 阅读全文
posted @ 2023-02-19 21:42 roadwide 阅读(32) 评论(0) 推荐(0)
摘要:import "math/rand" n := rand.Intn(100) // n is a random int, 0 <= n < 100 f := rand.Float64() // f is a random float64, 0.0 <= f < 1.0 x := []string{" 阅读全文
posted @ 2023-02-19 16:17 roadwide 阅读(23) 评论(0) 推荐(0)
摘要:Structs 类型定义(type)相当于一种别名 将struct定义为一种类型Car NewCar函数return &Car{},返回指针 // car.go package elon // Car implements a remote controlled car. type Car stru 阅读全文
posted @ 2023-02-19 15:41 roadwide 阅读(81) 评论(0) 推荐(0)
摘要:不需要手动break default是找不到case时执行 可以对多个case执行同样的操作 operatingSystem := "windows" switch operatingSystem { case "windows", "linux": // do something if the o 阅读全文
posted @ 2023-02-19 15:28 roadwide 阅读(59) 评论(0) 推荐(0)
摘要:声明Slice var empty []int // an empty slice withData := []int{0,1,2,3,4,5} // a slice pre-filled with some data make([]T, len) make([]T, len, cap) // sa 阅读全文
posted @ 2023-02-18 21:48 roadwide 阅读(79) 评论(0) 推荐(0)
摘要:General %v the value in a default format when printing structs, the plus flag (%+v) adds field names %#v a Go-syntax representation of the value %T a 阅读全文
posted @ 2023-02-18 21:24 roadwide 阅读(36) 评论(0) 推荐(0)
摘要:Strings A string in Go is an immutable(不可变的) sequence of bytes, which don't necessarily have to represent characters. double quotes("") 和 backticks(`) 阅读全文
posted @ 2023-02-18 15:19 roadwide 阅读(76) 评论(0) 推荐(0)
摘要:Numbers int64取值范围是多少?(面试题) [-2^63, 2^63-1] int64就是用64bit表示一个数字,由于需要区分正负,所以减去1位的符号位,符号位0表示正,1表示负。剩下63位来表示数字。 或者这样想,不考虑符号,64bit最大的数是2^64-1,也就是64位全1。再把这个 阅读全文
posted @ 2023-02-18 13:59 roadwide 阅读(277) 评论(0) 推荐(0)
摘要:Packages Go语言中的包和其他语言的库或模块的概念类似,目的都是为了支持模块化、封装、单独编译和代码重用。一个包的源代码保存在一个或多个以.go为文件后缀名的源文件中,通常一个包所在目录路径的后缀是包的导入路径;例如包gopl.io/ch1/helloworld对应的目录路径是 $GOPAT 阅读全文
posted @ 2023-02-18 13:01 roadwide 阅读(35) 评论(0) 推荐(0)