mirror of
https://github.com/zhufuyi/sponge.git
synced 2025-10-06 17:26:58 +08:00
change docs
This commit is contained in:
8
Makefile
8
Makefile
@@ -177,7 +177,13 @@ patch:
|
||||
.PHONY: copy-proto
|
||||
# copy proto file from the rpc server directory, multiple directories separated by commas. e.g. make copy-proto SERVER=yourServerDir
|
||||
copy-proto:
|
||||
@bash scripts/copy-proto.sh $(SERVER)
|
||||
@sponge patch copy-proto --server-dir=$(SERVER)
|
||||
|
||||
|
||||
.PHONY: update-config
|
||||
# update internal/config code base on yaml file
|
||||
update-config:
|
||||
@sponge config --server-dir=.
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 93 KiB |
@@ -179,9 +179,10 @@ import (
|
||||
|
||||
{{- range .PbServices}}
|
||||
|
||||
// {{.LowerName}} http service level error code
|
||||
// {{.LowerName}} business-level http error codes.
|
||||
// the {{.LowerName}}NO value range is 1~100, if the same number appears, it will cause a failure to start the service.
|
||||
var (
|
||||
{{.LowerName}}NO = {{.RandNumber}} // number range 1~100, if there is the same number, trigger panic.
|
||||
{{.LowerName}}NO = {{.RandNumber}}
|
||||
{{.LowerName}}Name = "{{.LowerName}}"
|
||||
{{.LowerName}}BaseCode = errcode.HCode({{.LowerName}}NO)
|
||||
// --blank line--
|
||||
|
@@ -189,9 +189,10 @@ import (
|
||||
|
||||
{{- range .PbServices}}
|
||||
|
||||
// {{.LowerName}} rpc service level error code
|
||||
// {{.LowerName}} business-level rpc error codes.
|
||||
// the {{.LowerName}}NO value range is 1~100, if the same number appears, it will cause a failure to start the service.
|
||||
var (
|
||||
_{{.LowerName}}NO = {{.RandNumber}} // number range 1~100, if there is the same number, trigger panic.
|
||||
_{{.LowerName}}NO = {{.RandNumber}}
|
||||
_{{.LowerName}}Name = "{{.LowerName}}"
|
||||
_{{.LowerName}}BaseCode = errcode.RCode(_{{.LowerName}}NO)
|
||||
// --blank line--
|
||||
|
@@ -244,9 +244,10 @@ import (
|
||||
|
||||
{{- range .PbServices}}
|
||||
|
||||
// {{.LowerName}} rpc service level error code
|
||||
// {{.LowerName}} business-level rpc error codes.
|
||||
// the _{{.LowerName}}NO value range is 1~100, if the same number appears, it will cause a failure to start the service.
|
||||
var (
|
||||
_{{.LowerName}}NO = {{.RandNumber}} // number range 1~100, if there is the same number, trigger panic.
|
||||
_{{.LowerName}}NO = {{.RandNumber}}
|
||||
_{{.LowerName}}Name = "{{.LowerName}}"
|
||||
_{{.LowerName}}BaseCode = errcode.RCode(_{{.LowerName}}NO)
|
||||
// --blank line--
|
||||
|
@@ -155,7 +155,7 @@ func saveFile(inputFile string, outputFile string, code string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("%s ----> %s\n", inputFile, outputFile)
|
||||
fmt.Printf("update \"%s\" --> \"%s\"\n", inputFile, outputFile)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@@ -212,8 +212,8 @@ func Init(configFile string, fs ...func()) error {
|
||||
return conf.Parse(configFile, config, fs...)
|
||||
}
|
||||
|
||||
func Show() string {
|
||||
return conf.Show(config)
|
||||
func Show(hiddenFields ...string) string {
|
||||
return conf.Show(config, hiddenFields...)
|
||||
}
|
||||
|
||||
func Get() *Config {
|
||||
|
32
docs/docs.go
32
docs/docs.go
@@ -253,6 +253,38 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/codes": {
|
||||
"get": {
|
||||
"description": "list error codes info",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"system"
|
||||
],
|
||||
"summary": "list error codes info",
|
||||
"responses": {}
|
||||
}
|
||||
},
|
||||
"/config": {
|
||||
"get": {
|
||||
"description": "show config info",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"system"
|
||||
],
|
||||
"summary": "show config info",
|
||||
"responses": {}
|
||||
}
|
||||
},
|
||||
"/health": {
|
||||
"get": {
|
||||
"description": "check health",
|
||||
|
@@ -249,6 +249,38 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/codes": {
|
||||
"get": {
|
||||
"description": "list error codes info",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"system"
|
||||
],
|
||||
"summary": "list error codes info",
|
||||
"responses": {}
|
||||
}
|
||||
},
|
||||
"/config": {
|
||||
"get": {
|
||||
"description": "show config info",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"system"
|
||||
],
|
||||
"summary": "show config info",
|
||||
"responses": {}
|
||||
}
|
||||
},
|
||||
"/health": {
|
||||
"get": {
|
||||
"description": "check health",
|
||||
|
@@ -286,6 +286,28 @@ paths:
|
||||
summary: list of userExamples by batch id
|
||||
tags:
|
||||
- userExample
|
||||
/codes:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: list error codes info
|
||||
produces:
|
||||
- application/json
|
||||
responses: {}
|
||||
summary: list error codes info
|
||||
tags:
|
||||
- system
|
||||
/config:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: show config info
|
||||
produces:
|
||||
- application/json
|
||||
responses: {}
|
||||
summary: show config info
|
||||
tags:
|
||||
- system
|
||||
/health:
|
||||
get:
|
||||
consumes:
|
||||
|
@@ -442,6 +442,11 @@ func getModelStructCode(data tmplData, importPaths []string, isEmbed bool) (stri
|
||||
for i, field := range data.Fields {
|
||||
if strings.Contains(field.GoType, "time.Time") {
|
||||
data.Fields[i].GoType = "*time.Time"
|
||||
continue
|
||||
}
|
||||
// force conversion of ID field to uint64 type
|
||||
if field.Name == "ID" {
|
||||
data.Fields[i].GoType = "uint64"
|
||||
}
|
||||
}
|
||||
newImportPaths = importPaths
|
||||
|
@@ -2,6 +2,13 @@
|
||||
|
||||
HOST_ADDR=$1
|
||||
|
||||
function checkResult() {
|
||||
result=$1
|
||||
if [ ${result} -ne 0 ]; then
|
||||
exit ${result}
|
||||
fi
|
||||
}
|
||||
|
||||
# change host addr
|
||||
if [ "X${HOST_ADDR}" = "X" ];then
|
||||
HOST_ADDR=$(cat cmd/serverNameExample_mixExample/main.go | grep "@host" | awk '{print $3}')
|
||||
@@ -11,6 +18,7 @@ else
|
||||
fi
|
||||
|
||||
swag init -g cmd/serverNameExample_mixExample/main.go
|
||||
checkResult $?
|
||||
|
||||
colorCyan='\e[1;36m'
|
||||
highBright='\e[1m'
|
||||
|
Reference in New Issue
Block a user