Skip to content

Commit

Permalink
Merge pull request #18 from glennliao/dev
Browse files Browse the repository at this point in the history
## 0.2.0-beta2
  • Loading branch information
glennliao authored Mar 14, 2023
2 parents c11c6b3 + e8d753e commit 0b96d1c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
12 changes: 6 additions & 6 deletions drivers/framework_goframe/gf.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ func (gf *GF) Bind(group *ghttp.RouterGroup, mode ...Mode) {
if len(mode) == 0 {
mode = []Mode{InDataMode}
}
group.POST("/get", gf.commonResponse(gf.Get, mode[0]))
group.POST("/post", gf.commonResponse(gf.Post, mode[0]))
group.POST("/head", gf.commonResponse(gf.Head, mode[0]))
group.POST("/put", gf.commonResponse(gf.Put, mode[0]))
group.POST("/delete", gf.commonResponse(gf.Delete, mode[0]))
group.POST("/get", gf.CommonResponse(gf.Get, mode[0]))
group.POST("/post", gf.CommonResponse(gf.Post, mode[0]))
group.POST("/head", gf.CommonResponse(gf.Head, mode[0]))
group.POST("/put", gf.CommonResponse(gf.Put, mode[0]))
group.POST("/delete", gf.CommonResponse(gf.Delete, mode[0]))
}

func (gf *GF) Get(ctx context.Context, req model.Map) (res model.Map, err error) {
Expand All @@ -76,7 +76,7 @@ func (gf *GF) Delete(ctx context.Context, req model.Map) (res model.Map, err err
return act.Result()
}

func (gf *GF) commonResponse(handler func(ctx context.Context, req model.Map) (res model.Map, err error), mode Mode) func(req *ghttp.Request) {
func (gf *GF) CommonResponse(handler func(ctx context.Context, req model.Map) (res model.Map, err error), mode Mode) func(req *ghttp.Request) {
return func(req *ghttp.Request) {
metaRes := &gmap.ListMap{}
code := 200
Expand Down
2 changes: 1 addition & 1 deletion query/node_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (q *queryNode) parse() {
return
}

n.primaryTableKey = n.Key
n.primaryTableKey = filepath.Base(n.Path)

if len(refKeyMap) > 0 { // 需要引用别处
n.refKeyMap = make(map[string]NodeRef)
Expand Down
10 changes: 6 additions & 4 deletions query/node_struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/glennliao/apijson-go/consts"
"github.com/glennliao/apijson-go/model"
"github.com/gogf/gf/v2/errors/gerror"
"path/filepath"
"strings"
)

Expand All @@ -18,6 +19,10 @@ func newStructNode(n *Node) *structNode {
func (h *structNode) parse() {
n := h.node

for _, childNode := range n.children {
childNode.parse()
}

if n.isList { // []节点

hasPrimary := false // 是否存在主查询表
Expand All @@ -35,7 +40,7 @@ func (h *structNode) parse() {
}

hasPrimary = true
n.primaryTableKey = child.Key
n.primaryTableKey = filepath.Base(child.Key)
child.page = n.page

}
Expand All @@ -46,9 +51,6 @@ func (h *structNode) parse() {
}
}

for _, childNode := range n.children {
childNode.parse()
}
}

func (h *structNode) fetch() {
Expand Down

0 comments on commit 0b96d1c

Please sign in to comment.