docs: 增加 space 包 README.md 文档,优化 room 相关内容可读性

This commit is contained in:
kercylan98
2023-12-23 10:59:20 +08:00
parent 05aeed05a1
commit 9d9f7a3854
9 changed files with 356 additions and 241 deletions

23
utils/super/function.go Normal file
View File

@@ -0,0 +1,23 @@
package super
// Handle 执行 f 函数,如果 f 为 nil则不执行
func Handle(f func()) {
if f != nil {
f()
}
}
// HandleErr 执行 f 函数,如果 f 为 nil则不执行
func HandleErr(f func() error) error {
if f != nil {
return f()
}
return nil
}
// HandleV 执行 f 函数,如果 f 为 nil则不执行
func HandleV[V any](v V, f func(v V)) {
if f != nil {
f(v)
}
}