From f9d31888ee98449c2bd6d3239d1039e324f57d0e Mon Sep 17 00:00:00 2001 From: kercylan <61743331+kercylan98@users.noreply.github.com> Date: Sun, 14 Jan 2024 18:41:52 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=BC=98=E5=8C=96=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=83=A8=E5=88=86=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E5=AF=BC=E8=88=AA=E5=8C=85=E5=90=AB=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=83=A8=E5=88=86=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/internal/deadlock-detect-server/README.md | 5 ++++- examples/internal/room-shunt-server/README.md | 5 ++++- .../internal/simple-echo-websocket-server/README.md | 5 ++++- examples/internal/ticker-server/README.md | 5 ++++- examples/internal/ticker/README.md | 5 ++++- game/README.md | 5 ++++- game/activity/internal/example/README.md | 5 ++++- game/activity/internal/example/activities/README.md | 5 ++++- .../example/activities/demoactivity/README.md | 5 ++++- planner/README.md | 5 ++++- planner/pce/exporter/README.md | 5 ++++- planner/pce/exporter/cmd/README.md | 4 ++++ utils/README.md | 5 ++++- utils/compress/README.md | 4 ++++ utils/crypto/README.md | 4 ++++ utils/file/README.md | 4 ++++ utils/generator/genreadme/builder.go | 13 ++++++++++--- utils/network/README.md | 4 ++++ utils/random/README.md | 4 ++++ utils/reflects/README.md | 4 ++++ utils/runtimes/README.md | 4 ++++ utils/sorts/README.md | 4 ++++ utils/str/README.md | 4 ++++ utils/xlsxtool/README.md | 4 ++++ 24 files changed, 102 insertions(+), 15 deletions(-) diff --git a/examples/internal/deadlock-detect-server/README.md b/examples/internal/deadlock-detect-server/README.md index ffcf1c6..530acf4 100644 --- a/examples/internal/deadlock-detect-server/README.md +++ b/examples/internal/deadlock-detect-server/README.md @@ -18,5 +18,8 @@ |:--|:-- + + + + *** -## 详情信息 diff --git a/examples/internal/room-shunt-server/README.md b/examples/internal/room-shunt-server/README.md index ffcf1c6..530acf4 100644 --- a/examples/internal/room-shunt-server/README.md +++ b/examples/internal/room-shunt-server/README.md @@ -18,5 +18,8 @@ |:--|:-- + + + + *** -## 详情信息 diff --git a/examples/internal/simple-echo-websocket-server/README.md b/examples/internal/simple-echo-websocket-server/README.md index ffcf1c6..530acf4 100644 --- a/examples/internal/simple-echo-websocket-server/README.md +++ b/examples/internal/simple-echo-websocket-server/README.md @@ -18,5 +18,8 @@ |:--|:-- + + + + *** -## 详情信息 diff --git a/examples/internal/ticker-server/README.md b/examples/internal/ticker-server/README.md index ffcf1c6..530acf4 100644 --- a/examples/internal/ticker-server/README.md +++ b/examples/internal/ticker-server/README.md @@ -18,5 +18,8 @@ |:--|:-- + + + + *** -## 详情信息 diff --git a/examples/internal/ticker/README.md b/examples/internal/ticker/README.md index ffcf1c6..530acf4 100644 --- a/examples/internal/ticker/README.md +++ b/examples/internal/ticker/README.md @@ -18,5 +18,8 @@ |:--|:-- + + + + *** -## 详情信息 diff --git a/game/README.md b/game/README.md index 0a38652..d944d3c 100644 --- a/game/README.md +++ b/game/README.md @@ -6,5 +6,8 @@ game 目录下包含了各类通用的游戏玩法性内容,其中该目录主要为基础性内容,具体目录将对应不同的游戏功能性内容。 + + + + *** -## 详情信息 diff --git a/game/activity/internal/example/README.md b/game/activity/internal/example/README.md index ffcf1c6..530acf4 100644 --- a/game/activity/internal/example/README.md +++ b/game/activity/internal/example/README.md @@ -18,5 +18,8 @@ |:--|:-- + + + + *** -## 详情信息 diff --git a/game/activity/internal/example/activities/README.md b/game/activity/internal/example/activities/README.md index aa77080..4ea85a5 100644 --- a/game/activity/internal/example/activities/README.md +++ b/game/activity/internal/example/activities/README.md @@ -18,5 +18,8 @@ |:--|:-- + + + + *** -## 详情信息 diff --git a/game/activity/internal/example/activities/demoactivity/README.md b/game/activity/internal/example/activities/demoactivity/README.md index 0fcb6dc..dfacb92 100644 --- a/game/activity/internal/example/activities/demoactivity/README.md +++ b/game/activity/internal/example/activities/demoactivity/README.md @@ -18,5 +18,8 @@ |:--|:-- + + + + *** -## 详情信息 diff --git a/planner/README.md b/planner/README.md index 926856a..8e6c7d6 100644 --- a/planner/README.md +++ b/planner/README.md @@ -6,5 +6,8 @@ planner 包含了策划工具相关的内容 + + + + *** -## 详情信息 diff --git a/planner/pce/exporter/README.md b/planner/pce/exporter/README.md index ffcf1c6..530acf4 100644 --- a/planner/pce/exporter/README.md +++ b/planner/pce/exporter/README.md @@ -18,5 +18,8 @@ |:--|:-- + + + + *** -## 详情信息 diff --git a/planner/pce/exporter/cmd/README.md b/planner/pce/exporter/cmd/README.md index 56aceb4..8f0e44a 100644 --- a/planner/pce/exporter/cmd/README.md +++ b/planner/pce/exporter/cmd/README.md @@ -19,6 +19,10 @@ |[Execute](#Execute)|将所有子命令添加到根命令并适当设置标志。这是由 main.main() 调用的。 rootCmd 只需要发生一次 + + + + *** ## 详情信息 #### func Execute() diff --git a/utils/README.md b/utils/README.md index ecbc402..4ed0ec0 100644 --- a/utils/README.md +++ b/utils/README.md @@ -11,5 +11,8 @@ utils 旨在提供一组用于处理通用功能的函数和数据结构。该 - 工具函数:该包还提供了一些通用的工具函数,如字符串处理、日期时间操作和文件操作等。这些工具函数可以帮助您简化代码编写,处理文本数据,操作日期时间,读写文件等。 + + + + *** -## 详情信息 diff --git a/utils/compress/README.md b/utils/compress/README.md index 3b76e37..e9dd833 100644 --- a/utils/compress/README.md +++ b/utils/compress/README.md @@ -24,6 +24,10 @@ compress 提供了一些用于压缩和解压缩数据的函数。 |[ZIPUnCompress](#ZIPUnCompress)|对已进行ZIP压缩的数据进行解压缩,返回字节数组及错误信息 + + + + *** ## 详情信息 #### func GZipCompress(data []byte) bytes.Buffer, error diff --git a/utils/crypto/README.md b/utils/crypto/README.md index f3bba8c..0dad578 100644 --- a/utils/crypto/README.md +++ b/utils/crypto/README.md @@ -28,6 +28,10 @@ |[DecodedSHA256](#DecodedSHA256)|对字节数组进行SHA256加密并返回其结果。 + + + + *** ## 详情信息 #### func EncryptBase64(data []byte) string diff --git a/utils/file/README.md b/utils/file/README.md index cd74af9..a686be2 100644 --- a/utils/file/README.md +++ b/utils/file/README.md @@ -29,6 +29,10 @@ |[FindLineChunksByOffset](#FindLineChunksByOffset)|该函数与 FindLineChunks 类似,不同的是该函数可以指定 offset 从指定位置开始读取文件 + + + + *** ## 详情信息 #### func PathExist(path string) bool, error diff --git a/utils/generator/genreadme/builder.go b/utils/generator/genreadme/builder.go index 3ee24e4..174ede2 100644 --- a/utils/generator/genreadme/builder.go +++ b/utils/generator/genreadme/builder.go @@ -9,6 +9,7 @@ import ( "github.com/kercylan98/minotaur/utils/super" "go/format" "strings" + "sync" ) func New(pkgDirPath string, output string) (*Builder, error) { @@ -97,14 +98,18 @@ func (b *Builder) genMenus() { collection.FindFirstOrDefaultInSlice(structInfo.Comments.Clear, "暂无描述..."), ) } - b.detailsEnd() } - + b.detailsEnd() b.newLine("***") } func (b *Builder) genStructs() { - b.title(2, "详情信息") + var titleOnce sync.Once + var titleBuild = func() { + titleOnce.Do(func() { + b.title(2, "详情信息") + }) + } var funcHandler = func(params []*astgo.Field) string { var s string @@ -127,6 +132,7 @@ func (b *Builder) genStructs() { if function.Internal || function.Test { continue } + titleBuild() b.title(4, strings.TrimSpace(fmt.Sprintf("func %s%s %s", function.Name, func() string { @@ -165,6 +171,7 @@ func (b *Builder) genStructs() { if structInfo.Internal || structInfo.Test { continue } + titleBuild() b.title(3, fmt.Sprintf("%s `%s`", structInfo.Name, super.If(structInfo.Interface, "INTERFACE", "STRUCT"))) b.newLine(structInfo.Comments.Clear...) b.newLine("```go") diff --git a/utils/network/README.md b/utils/network/README.md index 0d4120c..cd6d12c 100644 --- a/utils/network/README.md +++ b/utils/network/README.md @@ -19,6 +19,10 @@ |[IP](#IP)|返回本机出站地址 + + + + *** ## 详情信息 #### func IP() (ip net.IP, err error) diff --git a/utils/random/README.md b/utils/random/README.md index b996a86..ede0c12 100644 --- a/utils/random/README.md +++ b/utils/random/README.md @@ -46,6 +46,10 @@ |[WeightMapKey](#WeightMapKey)|按权重随机从map中产生一个数据并返回数据和对应 key + + + + *** ## 详情信息 #### func Dice() int diff --git a/utils/reflects/README.md b/utils/reflects/README.md index adb6763..425d111 100644 --- a/utils/reflects/README.md +++ b/utils/reflects/README.md @@ -26,6 +26,10 @@ |[GetPointer](#GetPointer)|获取指针 + + + + *** ## 详情信息 #### func WrapperFunc(f any, wrapper func (call func ( []reflect.Value) []reflect.Value) func (args []reflect.Value) []reflect.Value) (wf Func, err error) diff --git a/utils/runtimes/README.md b/utils/runtimes/README.md index b381dc9..de0fe23 100644 --- a/utils/runtimes/README.md +++ b/utils/runtimes/README.md @@ -23,6 +23,10 @@ |[CurrentRunningFuncName](#CurrentRunningFuncName)|获取正在运行的函数名 + + + + *** ## 详情信息 #### func GetWorkingDir() string diff --git a/utils/sorts/README.md b/utils/sorts/README.md index ff779d9..ff6abce 100644 --- a/utils/sorts/README.md +++ b/utils/sorts/README.md @@ -19,6 +19,10 @@ |[Topological](#Topological)|拓扑排序是一种对有向图进行排序的算法,它可以用来解决一些依赖关系的问题,比如计算字段的依赖关系。拓扑排序会将存在依赖关系的元素进行排序,使得依赖关系的元素总是排在被依赖的元素之前。 + + + + *** ## 详情信息 #### func Topological(slice S, queryIndexHandler func (item V) Index, queryDependsHandler func (item V) []Index) S, error diff --git a/utils/str/README.md b/utils/str/README.md index 0d9846e..d03e7fe 100644 --- a/utils/str/README.md +++ b/utils/str/README.md @@ -40,6 +40,10 @@ |[FormatSpeedyFloat64](#FormatSpeedyFloat64)|返回numberStr经过格式化后去除空格和“,”分隔符的结果 + + + + *** ## 详情信息 #### func RangeLine(eachString string, eachFunc func (index int, line string) error) error diff --git a/utils/xlsxtool/README.md b/utils/xlsxtool/README.md index b54becc..e5a07fa 100644 --- a/utils/xlsxtool/README.md +++ b/utils/xlsxtool/README.md @@ -19,6 +19,10 @@ |[GetSheetMatrix](#GetSheetMatrix)|将sheet转换为二维矩阵 + + + + *** ## 详情信息 #### func GetSheetMatrix(sheet *xlsx.Sheet) *matrix.Matrix[*xlsx.Cell]