@@ -7,47 +7,47 @@ import (
77 "github.com/glennliao/apijson-go/config/executor"
88 "github.com/glennliao/apijson-go/config/functions"
99 "github.com/glennliao/apijson-go/consts"
10+ "github.com/glennliao/apijson-go/model"
1011 "github.com/glennliao/apijson-go/util"
1112 "github.com/gogf/gf/v2/errors/gerror"
12- "github.com/gogf/gf/v2/frame/g"
1313 "github.com/gogf/gf/v2/util/gconv"
1414 "github.com/samber/lo"
1515 "net/http"
1616 "strings"
1717)
1818
1919type Node struct {
20- req []g .Map
20+ req []model .Map
2121 ctx context.Context
2222 action * Action
2323 Key string
2424 TableName string
2525 Role string
2626
27- Data []g .Map // 需写入数据库的数据
28- Where []g .Map // 条件
29- RowKey string // 主键
27+ Data []model .Map // 需写入数据库的数据
28+ Where []model .Map // 条件
29+ RowKey string // 主键
3030
3131 structure * db.Structure
3232 executor string
3333
3434 keyNode map [string ]* Node
3535}
3636
37- func newNode (key string , req []g .Map , structure * db.Structure , executor string ) Node {
37+ func newNode (key string , req []model .Map , structure * db.Structure , executor string ) Node {
3838 return Node {
3939 Key : key , req : req , structure : structure , executor : executor ,
4040 }
4141}
4242
4343func (n * Node ) parseReq (method string ) {
44- n .Data = []g .Map {}
45- n .Where = []g .Map {}
44+ n .Data = []model .Map {}
45+ n .Where = []model .Map {}
4646
4747 for i , item := range n .req {
4848
49- n .Data = append (n .Data , g .Map {})
50- n .Where = append (n .Where , g .Map {})
49+ n .Data = append (n .Data , model .Map {})
50+ n .Where = append (n .Where , model .Map {})
5151
5252 for key , val := range item {
5353 if key == consts .Role {
@@ -231,7 +231,7 @@ func (n *Node) reqUpdate() error {
231231
232232 if strings .HasSuffix (key , consts .FunctionsKeySuffix ) {
233233 functionName , paramKeys := util .ParseFunctionsStr (updateVal .(string ))
234- var param = g .Map {}
234+ var param = model .Map {}
235235 for _ , paramKey := range paramKeys {
236236 if paramKey == consts .FunctionOriReqParam {
237237 param [paramKey ] = n .Data [i ]
@@ -283,7 +283,7 @@ func (n *Node) reqUpdateBeforeDo() error {
283283 return nil
284284}
285285
286- func (n * Node ) do (ctx context.Context , method string , dataIndex int ) (ret g .Map , err error ) {
286+ func (n * Node ) do (ctx context.Context , method string , dataIndex int ) (ret model .Map , err error ) {
287287
288288 err = EmitHook (ctx , BeforeDo , n , method )
289289 if err != nil {
@@ -295,7 +295,7 @@ func (n *Node) do(ctx context.Context, method string, dataIndex int) (ret g.Map,
295295 switch method {
296296 case http .MethodPost :
297297
298- var rowKeyVal g .Map
298+ var rowKeyVal model .Map
299299
300300 access , err := db .GetAccess (n .Key , true )
301301 if err != nil {
@@ -329,7 +329,7 @@ func (n *Node) do(ctx context.Context, method string, dataIndex int) (ret g.Map,
329329 return nil , err
330330 }
331331
332- ret = g .Map {
332+ ret = model .Map {
333333 "code" : 200 ,
334334 "count" : count ,
335335 "id" : id ,
@@ -355,7 +355,7 @@ func (n *Node) do(ctx context.Context, method string, dataIndex int) (ret g.Map,
355355 return nil , err
356356 }
357357
358- ret = g .Map {
358+ ret = model .Map {
359359 "code" : 200 ,
360360 "count" : count ,
361361 }
@@ -365,7 +365,7 @@ func (n *Node) do(ctx context.Context, method string, dataIndex int) (ret g.Map,
365365 return nil , err
366366 }
367367
368- ret = g .Map {
368+ ret = model .Map {
369369 "code" : 200 ,
370370 "count" : count ,
371371 }
@@ -383,7 +383,7 @@ func (n *Node) do(ctx context.Context, method string, dataIndex int) (ret g.Map,
383383 return
384384}
385385
386- func (n * Node ) execute (ctx context.Context , method string ) (g .Map , error ) {
386+ func (n * Node ) execute (ctx context.Context , method string ) (model .Map , error ) {
387387
388388 err := n .reqUpdateBeforeDo ()
389389 if err != nil {
@@ -405,7 +405,7 @@ func (n *Node) execute(ctx context.Context, method string) (g.Map, error) {
405405 }
406406 }
407407
408- return g .Map {
408+ return model .Map {
409409 "code" : 200 ,
410410 }, nil
411411}
0 commit comments