+ Import API & 处理器
This commit is contained in:
parent
7f5d9e9990
commit
5da0b00b72
3 changed files with 156 additions and 0 deletions
49
importer/process.go
Normal file
49
importer/process.go
Normal file
|
|
@ -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
|
||||
}
|
||||
38
importer/process_test.go
Normal file
38
importer/process_test.go
Normal file
|
|
@ -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)
|
||||
}
|
||||
69
xiang/apis/import.http.json
Normal file
69
xiang/apis/import.http.json
Normal file
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue