diff --git a/.idea/sk-matrix-project.iml b/.idea/sk-matrix-project.iml index 25ed3f6..8f6e9a6 100644 --- a/.idea/sk-matrix-project.iml +++ b/.idea/sk-matrix-project.iml @@ -3,7 +3,10 @@ - + + + + diff --git a/backend/golang/matrix-middle-service/.air.toml b/backend/golang/matrix-middle-service/.air.toml new file mode 100644 index 0000000..ff17b34 --- /dev/null +++ b/backend/golang/matrix-middle-service/.air.toml @@ -0,0 +1,48 @@ +# 工作目录 +# 使用 . 或绝对路径,请注意 `tmp_dir` 目录必须在 `root` 目录下 +root = "." +tmp_dir = "tmp" + +[build] +# 只需要写你平常编译使用的shell命令。你也可以使用 `make` +# Windows平台示例: cmd = "go build -o tmp\main.exe ." +cmd = "go build -o ./tmp/main ." + +# 由`cmd`命令得到的二进制文件名 +# Windows平台示例:bin = "tmp\main.exe" +bin = "tmp/main" + +# 自定义执行程序的命令,可以添加额外的编译标识例如添加 GIN_MODE=release +# Windows平台示例:full_bin = "tmp\main.exe" +#full_bin = "APP_ENV=dev APP_USER=air ./tmp/main" +full_bin = "tmp/main + +# 监听以下文件扩展名的文件. +include_ext = ["go", "tpl", "tmpl", "html"] +# 忽略这些文件扩展名或目录 +exclude_dir = ["assets", "tmp", "vendor", "frontend/node_modules"] +# 监听以下指定目录的文件 +include_dir = [] +# 排除以下文件 +exclude_file = [] +# 如果文件更改过于频繁,则没有必要在每次更改时都触发构建。可以设置触发构建的延迟时间 +delay = 1000 # ms +# 发生构建错误时,停止运行旧的二进制文件。 +stop_on_error = true +# air的日志文件名,该日志文件放置在你的`tmp_dir`中 +log = "air_errors.log" + +[log] +# 显示日志时间 +time = true + +[color] +# 自定义每个部分显示的颜色。如果找不到颜色,使用原始的应用程序日志。 +main = "magenta" +watcher = "cyan" +build = "yellow" +runner = "green" + +[misc] +# 退出时删除tmp目录 +clean_on_exit = true \ No newline at end of file diff --git a/backend/golang/matrix-middle-service/.gitignore b/backend/golang/matrix-middle-service/.gitignore index 093487d..f964b80 100644 --- a/backend/golang/matrix-middle-service/.gitignore +++ b/backend/golang/matrix-middle-service/.gitignore @@ -95,3 +95,4 @@ fabric.properties .idea/caches/build_file_checksums.ser config.toml +.$database.drawio.bkp \ No newline at end of file diff --git a/backend/golang/matrix-middle-service/.idea/codestream.xml b/backend/golang/matrix-middle-service/.idea/codestream.xml index 10b59b6..981e245 100644 --- a/backend/golang/matrix-middle-service/.idea/codestream.xml +++ b/backend/golang/matrix-middle-service/.idea/codestream.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/backend/golang/matrix-middle-service/database.drawio b/backend/golang/matrix-middle-service/database.drawio new file mode 100644 index 0000000..c4b7b3a --- /dev/null +++ b/backend/golang/matrix-middle-service/database.drawio @@ -0,0 +1 @@ +7V1tc5s4EP41/tgOWGA7H2snbW8uN5MmnWt7X25kkA0XQC5WYru//iSQMFjIxg3gF9FmJmYRkth99pG0Kzk9MAnXn2K48P7CLgp6fcNd98Btr983DTCgv5hkk0oGBhfMY9/lhbaCJ/8XEk9y6YvvomWhIME4IP6iKHRwFCGHFGQwjvGqWGyGg2KrCzhHkuDJgYEs/ea7xONS0zC2Nz4jf+7xpkc2vzGFzvM8xi8Rby/CEUrvhFBUw4suPejiVU4E7npgEmNM0k/heoICplahsfS5j4q7WZdjFJEqD/SRddMfGsgZOoPRDMzejXjHXmHwwvXw5cuYdiftLtkI7SxXfhhA+mJg7JEwoEKTfpzhiDzxQga9djw/cO/hBr+w7iwJ1Yy4Gns49n/R8lA8TG/HhOOgP2C1+UEwwQGOkyYBMtj/wpNPrEbeVoyW9NkH8e5mJrqHSyL6g4MALpb+NOkhKxLCeO5H9A0JDnkh8Wofi83Pkn/0Pgz8eURlDm0IxawZZmvkiseFTdMGQ9/hnwM4RcE4A4eoOoEHe/sYP2dIE8r8CEM/YA70N4pdGEGh41RLpiUbnGPgFcUErXMiDoBPCIeIxBtaRNwVYOR+agocr3KoH3CZlwO8OeRCyD1tntW9hRz9wFFXFYGmhEBaVoKfBxfsI31z4sPgkRI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f49/9GgHfPrx/5H7Ijp2L8p9r85OfvLuaSrZn9LU/aXMz5kszhqH8IVcL/C+Ppxvxy567i/de7PjnKcjvzftrnk4shfYY+rJ3853EfwM1WmXuyvsL527C+a7Nj/pOxfdnCvVfYHR8T/roD9Qf2HmS6C/YEc3zt+E/Ll07/K/PrRvxwIHGPydd9qUKOkvb2btK8an89m8/XzdBepayNpn/rF+SbtgRypu/KkPdA0WAfkYN35p2maTdqroKDf6N2F7tpYvB0YDE6etAd6Re6AppE7IEfuIhjqtnLrAnepIqwucHcG3H/ylL2lV9zO0jRuZ3Vxu33m14/9B5LhL/Ys1d4daQfPU6kWg5XPU72NfuUV2Dc0/Yzx8/7BWI/4afaFqyJsVjVulrlZ/QbrDj21ET+1zvzQk6XdoSdL00NPtrxO0j1+qoKCdrMouzv01MYa+sBgcPL4qS0vrk5MEI2uoW1NDz3Z8l6HY78p6/JX0Crj68f93UaKM+D+k8dPbb2OPNma7qKw5V0Ux3+18xWwf7dzgiui2zlxBux/+kNPtl5bJ2xNt07YcrhPx/SZyvza0b8IObSdPqO9/i78nF38YBfvbXF5u87fvN1kV62l3UR6pPmvMVTQNr3c/g291Nzbv1EI7v4H \ No newline at end of file diff --git a/backend/golang/matrix-middle-service/internel/route/route.go b/backend/golang/matrix-middle-service/internel/route/route.go index d71a36f..ae35fcf 100644 --- a/backend/golang/matrix-middle-service/internel/route/route.go +++ b/backend/golang/matrix-middle-service/internel/route/route.go @@ -6,5 +6,7 @@ import ( ) func SetupRoute(app *fiber.App, conf *config.Conf) { - SwaggerHandler(app) + if conf.Server.EnableSwag { + SwaggerHandler(app) + } } diff --git a/backend/golang/matrix-middle-service/pkg/utils/json/json.go b/backend/golang/matrix-middle-service/pkg/utils/json/json.go new file mode 100644 index 0000000..ceff889 --- /dev/null +++ b/backend/golang/matrix-middle-service/pkg/utils/json/json.go @@ -0,0 +1,10 @@ +package utils + +import ( + "github.com/goccy/go-json" +) + +func Json(data interface{}) string { + jsonBytes, _ := json.MarshalIndent(data, "", " ") + return string(jsonBytes) +}