json 工具方法
swagger 配置是否启用 air 热重载配置
This commit is contained in:
parent
998ae4a9b9
commit
2a122c2cfc
@ -3,7 +3,10 @@
|
||||
<component name="Go" enabled="true" />
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/frontend/matrix-middle-service-web/.yarn/cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/frontend/matrix-middle-service-web/.idea" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
|
48
backend/golang/matrix-middle-service/.air.toml
Normal file
48
backend/golang/matrix-middle-service/.air.toml
Normal file
@ -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
|
@ -95,3 +95,4 @@ fabric.properties
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
config.toml
|
||||
.$database.drawio.bkp
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CodeStream">
|
||||
<option name="webViewContext" value="{"chatProviderAccess":"strict","currentTeamId":"","currentStreamId":"","pullRequestCheckoutBranch":false,"isRepositioning":false,"onboardStep":0,"panelStack":["landing-redirect"],"hasFocus":false,"channelFilter":"all","channelsMuteAll":false,"codemarkFileFilter":"all","codemarkTypeFilter":"all","codemarkTagFilter":"all","codemarkBranchFilter":"all","codemarkAuthorFilter":"all","codemarksFileViewStyle":"inline","codemarksShowArchived":false,"codemarksShowResolved":false,"codemarksWrapComments":false,"showFeedbackSmiley":true,"route":{"name":"newUserEntry","params":{}},"spatialViewShowPRComments":false,"currentPullRequestNeedsRefresh":{"needsRefresh":false,"providerId":"","pullRequestId":""},"__teamless__":{"selectedRegion":"us"},"sessionStart":1677393421519}" />
|
||||
<option name="webViewContext" value="{"chatProviderAccess":"strict","currentTeamId":"","currentStreamId":"","pullRequestCheckoutBranch":false,"isRepositioning":false,"onboardStep":0,"panelStack":["landing-redirect"],"hasFocus":false,"channelFilter":"all","channelsMuteAll":false,"codemarkFileFilter":"all","codemarkTypeFilter":"all","codemarkTagFilter":"all","codemarkBranchFilter":"all","codemarkAuthorFilter":"all","codemarksFileViewStyle":"inline","codemarksShowArchived":false,"codemarksShowResolved":false,"codemarksWrapComments":false,"showFeedbackSmiley":true,"route":{"name":"newUserEntry","params":{}},"spatialViewShowPRComments":false,"currentPullRequestNeedsRefresh":{"needsRefresh":false,"providerId":"","pullRequestId":""},"__teamless__":{"selectedRegion":"us"},"sessionStart":1677477984122}" />
|
||||
</component>
|
||||
</project>
|
1
backend/golang/matrix-middle-service/database.drawio
Normal file
1
backend/golang/matrix-middle-service/database.drawio
Normal file
@ -0,0 +1 @@
|
||||
<mxfile host="Electron" modified="2023-02-27T06:39:36.955Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/20.8.16 Chrome/106.0.5249.199 Electron/21.4.0 Safari/537.36" etag="ym3DbQuuktsG5nx9iU64" version="20.8.16" type="device"><diagram name="Page-1" id="e56a1550-8fbb-45ad-956c-1786394a9013">7V1tc5s4EP41/tgOWGA7H2snbW8uN5MmnWt7X25kkA0XQC5WYru//iSQMFjIxg3gF9FmJmYRkth99pG0Kzk9MAnXn2K48P7CLgp6fcNd98Btr983DTCgv5hkk0oGBhfMY9/lhbaCJ/8XEk9y6YvvomWhIME4IP6iKHRwFCGHFGQwjvGqWGyGg2KrCzhHkuDJgYEs/ea7xONS0zC2Nz4jf+7xpkc2vzGFzvM8xi8Rby/CEUrvhFBUw4suPejiVU4E7npgEmNM0k/heoICplahsfS5j4q7WZdjFJEqD/SRddMfGsgZOoPRDMzejXjHXmHwwvXw5cuYdiftLtkI7SxXfhhA+mJg7JEwoEKTfpzhiDzxQga9djw/cO/hBr+w7iwJ1Yy4Gns49n/R8lA8TG/HhOOgP2C1+UEwwQGOkyYBMtj/wpNPrEbeVoyW9NkH8e5mJrqHSyL6g4MALpb+NOkhKxLCeO5H9A0JDnkh8Wofi83Pkn/0Pgz8eURlDm0IxawZZmvkiseFTdMGQ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10XLRt03WGT0WwPjPgvwyrZqObo2GFDyiSChPkJHvGUTHN2XJ2bH7c9owNI7s7XivGzQk3c5tAOFdU/pnHat0KhUXRvYkHNf3WCgWrE2NhiUrdtaHQyE1X9z7dYAQSDXF/XVPxKoJm1XPxLI+2eoAf49/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</diagram></mxfile>
|
@ -6,5 +6,7 @@ import (
|
||||
)
|
||||
|
||||
func SetupRoute(app *fiber.App, conf *config.Conf) {
|
||||
SwaggerHandler(app)
|
||||
if conf.Server.EnableSwag {
|
||||
SwaggerHandler(app)
|
||||
}
|
||||
}
|
||||
|
10
backend/golang/matrix-middle-service/pkg/utils/json/json.go
Normal file
10
backend/golang/matrix-middle-service/pkg/utils/json/json.go
Normal file
@ -0,0 +1,10 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"github.com/goccy/go-json"
|
||||
)
|
||||
|
||||
func Json(data interface{}) string {
|
||||
jsonBytes, _ := json.MarshalIndent(data, "", " ")
|
||||
return string(jsonBytes)
|
||||
}
|
Loading…
Reference in New Issue
Block a user