forked from YaoApp/yao
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
156 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package importer | ||
|
||
import "github.com/yaoapp/gou" | ||
|
||
func init() { | ||
// 注册处理器 | ||
gou.RegisterProcessHandler("xiang.import.Run", ProcessRun) | ||
gou.RegisterProcessHandler("xiang.import.Data", ProcessData) | ||
gou.RegisterProcessHandler("xiang.import.DataSetting", ProcessDataSetting) | ||
gou.RegisterProcessHandler("xiang.import.Mapping", ProcessMapping) | ||
gou.RegisterProcessHandler("xiang.import.MappingSetting", ProcessMappingSetting) | ||
gou.RegisterProcessHandler("xiang.import.Rules", ProcessRules) | ||
} | ||
|
||
// ProcessRun xiang.import.Run | ||
// 导入数据 | ||
func ProcessRun(process *gou.Process) interface{} { | ||
return nil | ||
} | ||
|
||
// ProcessData xiang.import.Data | ||
// 数据预览 | ||
func ProcessData(process *gou.Process) interface{} { | ||
return nil | ||
} | ||
|
||
// ProcessDataSetting xiang.import.DataSetting | ||
// 数据预览表格配置 | ||
func ProcessDataSetting(process *gou.Process) interface{} { | ||
return nil | ||
} | ||
|
||
// ProcessMapping xiang.import.Mapping | ||
// 字段映射预览 | ||
func ProcessMapping(process *gou.Process) interface{} { | ||
return nil | ||
} | ||
|
||
// ProcessMappingSetting xiang.import.MappingSetting | ||
// 字段映射表格配置 | ||
func ProcessMappingSetting(process *gou.Process) interface{} { | ||
return nil | ||
} | ||
|
||
// ProcessRules xiang.import.Rules | ||
// 可用处理器下拉列表 | ||
func ProcessRules(process *gou.Process) interface{} { | ||
return nil | ||
} |
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,38 @@ | ||
package importer | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/yaoapp/gou" | ||
) | ||
|
||
func TestProcessMapping(t *testing.T) { | ||
args := []interface{}{"order"} | ||
response := gou.NewProcess("xiang.import.Mapping", args...).Run() | ||
assert.Nil(t, response) | ||
} | ||
|
||
func TestProcessMappingSetting(t *testing.T) { | ||
args := []interface{}{"order"} | ||
response := gou.NewProcess("xiang.import.MappingSetting", args...).Run() | ||
assert.Nil(t, response) | ||
} | ||
|
||
func TestProcessData(t *testing.T) { | ||
args := []interface{}{"order"} | ||
response := gou.NewProcess("xiang.import.Data", args...).Run() | ||
assert.Nil(t, response) | ||
} | ||
|
||
func TestProcessDataSetting(t *testing.T) { | ||
args := []interface{}{"order"} | ||
response := gou.NewProcess("xiang.import.DataSetting", args...).Run() | ||
assert.Nil(t, response) | ||
} | ||
|
||
func TestProcessRules(t *testing.T) { | ||
args := []interface{}{"order"} | ||
response := gou.NewProcess("xiang.import.Rules", args...).Run() | ||
assert.Nil(t, response) | ||
} |
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,69 @@ | ||
{ | ||
"name": "数据导入接口", | ||
"version": "1.0.0", | ||
"description": "数据分析接口API", | ||
"group": "xiang/import", | ||
"guard": "bearer-jwt", | ||
"paths": [ | ||
{ | ||
"path": "/:name", | ||
"method": "POST", | ||
"process": "xiang.import.Run", | ||
"in": ["$param.name", ":payload"], | ||
"out": { | ||
"status": 200, | ||
"type": "application/json" | ||
} | ||
}, | ||
{ | ||
"path": "/:name/data", | ||
"method": "POST", | ||
"process": "xiang.import.Data", | ||
"in": ["$param.name", ":payload"], | ||
"out": { | ||
"status": 200, | ||
"type": "application/json" | ||
} | ||
}, | ||
{ | ||
"path": "/:name/data/setting", | ||
"method": "GET", | ||
"process": "xiang.import.DataSetting", | ||
"in": ["$param.name", ":query"], | ||
"out": { | ||
"status": 200, | ||
"type": "application/json" | ||
} | ||
}, | ||
{ | ||
"path": "/:name/mapping", | ||
"method": "GET", | ||
"process": "xiang.import.Mapping", | ||
"in": ["$param.name", ":query"], | ||
"out": { | ||
"status": 200, | ||
"type": "application/json" | ||
} | ||
}, | ||
{ | ||
"path": "/:name/mapping/setting", | ||
"method": "GET", | ||
"process": "xiang.import.MappingSetting", | ||
"in": ["$param.name", ":query"], | ||
"out": { | ||
"status": 200, | ||
"type": "application/json" | ||
} | ||
}, | ||
{ | ||
"path": "/:name/rule/select", | ||
"method": "GET", | ||
"process": "xiang.import.Rules", | ||
"in": ["$param.name", ":query"], | ||
"out": { | ||
"status": 200, | ||
"type": "application/json" | ||
} | ||
} | ||
] | ||
} |