j2go / apijson-go

Apache License 2.0
41 stars 9 forks source link

按示例执行get方法报错 #17

Open liushuai05 opened 2 years ago

liushuai05 commented 2 years ago

执行示例: ` POST 127.0.0.1:8080/get Content-Type: application/json

{ "Document": { "id{}": ">1" } } 终端输出 2022/06/08 14:01:16 Debug Document -> parse id{} >1 2022/06/08 14:01:16 Debug parse Document: &{ctx:0xc000030b80 start:1654668076502673478 depth:0 running:false completed:false isList:false page: count: sqlExecutor:0xc00016ea20 primaryKey: relateKV:map[] Key:Document Path:Document RequestMap:map[id{}:>1] CurrentData:map[] ResultList:[] children:map[]} 2022/06/08 14:01:16 Debug exec SELECT * FROM Document WHERE id{}=? LIMIT 1, params: [>1] 2022/06/08 14:01:16 http: superfluous response.WriteHeader call from github.com/j2go/apijson/handler.commonHandle (handler.go:41)

`

返回信息 ` {"code":200,"msg":"Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{}=? LIMIT 1' at line 1","ok":true}

`

phpmyadmin查询Document 表有数据存在

TommyLemon commented 2 years ago

目前表名需要小写,另外好像 "key{}":"表达式" 这个功能符未实现 @j2go ,不应该作为值带引号拼接,而是应该直接拼接 SQL。可以先试试其它功能 https://github.com/j2go/apijson-go/issues/13