随笔分类 -  Golang

摘要:iface.go package GabrielConfig import ( "context" "sync" ) type IGracefulExit interface { Cancel() GetCtx() context.Context GetWaitGroupInCtx() *sync. 阅读全文
posted @ 2020-12-30 16:32 路璐 阅读(882) 评论(0) 推荐(0)
摘要:package main import ( "errors" "math/rand" ) type CompareResult int // TODO 目前尚未实现并发安全,待办 const ( // 跳表节点key的比较回调函数返回值 -1:left<right;0:left==right;1:l 阅读全文
posted @ 2020-12-30 15:54 路璐 阅读(205) 评论(0) 推荐(0)
摘要:代码如下: 1 package main 2 3 import ( 4 "fmt" 5 "regexp" 6 ) 7 8 // 判断str是否与白名单中的正则表达式匹配 9 func generateMatch(whiteList []string) func(string) bool { 10 / 阅读全文
posted @ 2020-11-10 16:03 路璐 阅读(558) 评论(0) 推荐(0)
摘要:代码如下: 1 package main 2 3 import ( 4 "fmt" 5 ) 6 7 func pivot(arr []int, begin int, end int) int { 8 end-- 9 temp := arr[begin] 10 // 为减小最坏情况发生的几率,可以在b 阅读全文
posted @ 2020-11-10 10:10 路璐 阅读(488) 评论(0) 推荐(0)