-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1、增加测试用例; 2、支持多文件合并导表; 3、支持 "#" 开头忽略; 4、修复越界问题; 5、优化模板样式,增加模板规则说明;
- Loading branch information
1 parent
73cefc9
commit afdda79
Showing
22 changed files
with
267 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
examples/simple-server-config/config/configs/config.define.go
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
examples/simple-server-config/config/json/WelcomeConfig.json
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package configexport_test | ||
|
||
import ( | ||
"fmt" | ||
"github.com/kercylan98/minotaur/config" | ||
"github.com/kercylan98/minotaur/planner/configexport" | ||
"github.com/kercylan98/minotaur/planner/configexport/example" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
) | ||
|
||
func ExampleNew() { | ||
var workdir = "./" | ||
files, err := os.ReadDir(workdir) | ||
if err != nil { | ||
panic(err) | ||
} | ||
var ces []*configexport.ConfigExport | ||
for _, file := range files { | ||
if file.IsDir() || !strings.HasSuffix(file.Name(), ".xlsx") || strings.HasPrefix(file.Name(), "~") { | ||
continue | ||
} | ||
|
||
ces = append(ces, configexport.New(filepath.Join(workdir, file.Name()))) | ||
} | ||
|
||
c := configexport.Merge(ces...) | ||
outDir := filepath.Join(workdir, "example") | ||
c.ExportGo("", outDir) | ||
c.ExportServer("", outDir) | ||
c.ExportClient("", outDir) | ||
|
||
// 下方为配置加载代码 | ||
// 使用生成的 LoadConfig 函数加载配置 | ||
config.Init(outDir, example.LoadConfig, example.Refresh) | ||
|
||
fmt.Println("success") | ||
|
||
// Output: | ||
// success | ||
} |
This file was deleted.
Oops, something went wrong.
19 changes: 9 additions & 10 deletions
19
...nfigexport/example/client.EasyConfig.json → planner/configexport/example/EasyConfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
{ | ||
"Id": 1, | ||
"Award": { | ||
"0": "asd", | ||
"1": "12" | ||
}, | ||
"Other": { | ||
"1": { | ||
"id": 2, | ||
"name": "刘备" | ||
}, | ||
"0": { | ||
"id": 1, | ||
"name": "张飞" | ||
}, | ||
"1": { | ||
"id": 2, | ||
"name": "刘备" | ||
} | ||
}, | ||
"Id": 1, | ||
"Count": "a", | ||
"Award": { | ||
"0": "asd", | ||
"1": "12" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.