Giter VIP home page Giter VIP logo

apijson-go's People

Contributors

j2go avatar tommylemon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

apijson-go's Issues

设计方案

1. 服务启动流程

  1. 读取数据库里的表列表,为每个表生成一个管理对象,包括字段名,数值类型,缓存下来
  2. enmm
type TableObject struct {

}

2. 请求响应流程

2.1 get 请求

  1. 解析 json, 一级 key-value 作分类缓存处理. 根据 key 构造返回容器
  2. 二级字段解析,处理 @column 字段,验证是否有效,处理依赖数据,后续有先后执行依赖
  3. 构造执行器,按图先后执行,没有依赖的并发执行
  4. 返回结果

运行有问题

为什么运行之后,
image

然后在测试接口,返回结果报表不存在的错误。

image

数据库已经导入了。

image

数据库的版本是8.xxx的

推荐封装错误调用栈,方便返回 "trace:stack" 字段,用来快速排查问题原因

Log.DEBUG = true 时返回

http://apijson.cn/api/?type=JSON&json={"User":{"ids": 82001},"[]":{"Comment":{"userId@":"User%2Fid"}}}
image

这个字段仅仅用来查看错误栈信息,不用来解析,所以数组内格式不需要和 Java 一致,内部简单地使用字符串即可,例如

"trace:stack": [
  "sun.reflect.NativeConstructorAccessorImpl",
  "apijson.orm.AbstractParser"
]

相关推荐库
https://github.com/pkg/errors

按示例执行get方法报错

执行示例:
`
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 表有数据存在

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.