Create an CRUD API server directly from a table in database or a yaml file.
- Oracle
- Java (CAUSE IT IS THE WORST LANGUAGE IN THIS UNIVERSE!!!)
Create an CRUD API server directly from a table in database or/and a yaml file.
License: The Unlicense
计划使用
https://github.com/tiangolo/fastapi
作为后端框架
现在 Docker 镜像的版本号只支持手动指定。最好能自动确定。
Describe the solution you'd like
按顺序检查:
ci-v${GITHUB_RUN_NUMBER}
确定(若 $GITHUB_RUN_NUMBER 存在)Use GitHub Actions as our CI.
The CI should build binary files for all three major platforms.
目前计划要写的第一个测试是功能测试,测试流程如下:
仍待解决的问题是在测试环境起一个pgsql可能会存在困难。
eg. import "time"
for time.Time
etc
Describe the solution you'd like
从sql语句中直接parse出表结构
parser参考
eg.
k8s:
db: "postgres://xxx@shu-student-postgres-svc:5432/shu-student?sslmode=disable"
Should generate:
apiVersion: apps/v1
kind: Deployment
metadata:
name: shu-student
spec:
selector:
matchLabels:
run: shu-student
replicas: 1
template:
metadata:
labels:
run: shu-student
spec:
containers:
- name: shu-student
image: xxx/shu-student:138153507
livenessProbe:
httpGet:
path: /ping
port: 8000
initialDelaySeconds: 5
periodSeconds: 5
env:
- name: DB_ADDRESS
value: "postgres://xxx@shu-student-postgres-svc:5432/shu-student?sslmode=disable"
ports:
- containerPort: 8000
---
apiVersion: v1
kind: Service
metadata:
name: shu-student-svc
spec:
selector:
run: shu-student
ports:
- protocol: TCP
port: 8000
targetPort: 8000
And if no k8s
entry exists, nothing should be generated.
Maybe we need a --force
flag for our cli tool to control if rm -rf output
before generate.
And a -h / --help
for displaying usage.
Describe the solution you'd like
添加从DDL推断表结构的测试
Additional context
可以在 #56 找到添加功能测试的方法。
Add a complex
field in yaml and let the user specify SQL and return values by an api.
eg.
complex:
sql: "select aaa, bbb from ccc, ddd where eee = fff and ggg = $1 or hhh = $2;"
parmas:
- name: "iii"
type: int
- name: "jjj"
type: string
result:
name: "mmm"
array: true
page: true
fields:
- name: "kkk"
type: string
- name: "lll"
type: int64
Will generate an api endpoint like
/table/mmm?iii=1&jjj=qwerty&limit=10&offset=10
Currently our Github Actions file is just for CI.
We might create some CD for SSH server, GCP etc.
Describe the solution you'd like
添加从数据库推断表结构的测试。
Additional context
可以在 #56 找到添加功能测试的方法。
Write a web service to call this remotely and deploy it to somewhere.
目前生成的 GitHub Action 不包含CD功能,在完成 #9 之后,考虑支持 ssh 到目标服务器 apply 生成的yaml。
Describe the solution you'd like
使用 GHAction market 中的某个 ssh 库执行 ssh,apply生成的yaml
这屑代码丑的一匹
让爷给他重构了
一些重构的点:
WithCase
实现 Marshaler
等接口,以便直接从 yaml parse 出来计划使用koa作为后端框架
目前没有区分加载元信息的数据库和线上使用的数据库,但实际大部分情况下开发时会使用和线上不同的数据库地址。
Describe the solution you'd like
在设置项中区分这两个数据库。
目前发布的CI中并不包含生成Docker镜像的代码
Describe the solution you'd like
生成Docker镜像,并推送到Dockerhub。
Get Table name and fields info from yaml files
Auto decide everything it can from meta tables
dbengin: pgsql
tablename: test
Describe the solution you'd like
创建更多不同的例子。
目前的例子需要启动数据库才能运行(为了检查从数据库中拿元数据是否成功),但这对开发者的环境搭建提出了一定要求,即使对非相关功能的改动也需要起这个数据库,显得很蠢。
考虑:
Additional context
其他方案:
Blocked by #11.
Describe the bug
生成的k8s yaml中没有指定 DB_ADDRESS
Make it usable from command line!
Describe the solution you'd like
目前id类型固定为整数,但实际上对于部分场景(学生证号),id类型可以是字符串等,故可以考虑去掉这个限制。
如题
现在就加个go generate/go build 将来可以加test部分
Describe the solution you'd like
除了已经支持的 yaml 还支持
等
Additional context
不考虑支持xml,xml用来写配置文件是垃圾
目前生成 release 的CI有如下缺点:
autoAPI-(操作系统名)-amd64(扩展名)
,但是用户应该希望使用的二进制文件名是 autoAPI(扩展名)
Describe the solution you'd like
生成 autoAPI-(操作系统名)-amd64.zip
,内含对应平台的二进制文件,其名称为 autoAPI(扩展名)
https://github.com/marketplace/actions/go-cross-build might help.
Describe the solution you'd like
将 go 编译到wasm,使得这一项目可以在浏览器中使用
没空写代码可以把报告写一下。
最好可以搞一个生成报告的template.
除了已经支持的pgsql外,首批要支持的数据库包括:
Describe the solution you'd like
As @laojianzi suggested,引入一个linting tool。
Additional context
不知道会不会提高开发者的门槛……希望不会吧
Let's bring the power of the world fastest backend library to everyone!
Currently, no matter whether it is necessary, a Github Actions file will be generated.
But sometimes we don't need this, eg. in a repo which is full of yamls and use Github Actions itself to generate several docker images together.
So generating things like Github Actions files should be configuable.
eg.
githubactions: false
And it should has a default value true
.
Though most developer enjoy using things from CLI. There might be some users want to use a GUI.
So create a web GUI for this project might be useful.
Describe the solution you'd like
WE NEED JAVA!
Additional context
#JAVA LIVES MATTER
原本默认的那个SHA又臭又长,ci-v${GITHUB_RUN_NUMBER}
应该是一个比较合理的label。
Describe the solution you'd like
将默认 GitHub actions 文件中 docker 镜像的 label 改为 ci-v${GITHUB_RUN_NUMBER}
现在只支持 string
兼容类型
Describe the solution you'd like
在 handler 的模版里面支持各种类型的互相转化。
比如对整数类型就生成一个
{%v param.Name.CamelCase() %}Str := mux.Vars(r)["{%v param.Name.SnakeCase() %}"]
{%v param.Name.CamelCase() %}, err := strconv.ParseInt({%v param.Name.CamelCase() %}Str, 10, 64)
Describe the solution you'd like
所有文件是否需要统一,最后需要一行换行。
Additional context
Github review时能看到非常多的最后没有换行。
现在项目里的单复数是乱来的。
Describe the solution you'd like
可以用 https://github.com/jinzhu/inflection 来做单复数的转换。
Describe the solution you'd like
添加对复杂查询的测试。
Additional context
可以在 #56 找到添加功能测试的方法。
Describe the solution you'd like
在根目录下加一个 actions.yml
(可能需要配合相关的Dockerfile等等), 使得该项目可以直接作为 GitHub action 的一个step使用
根据数据库类型,生成相应的建表语句。
mentor:@longfangsong
Describe the solution you'd like
暂定:
为所有可能为空值的field实现 unmarshaler,并提供为空时的处理函数
Describe the solution you'd like
有一个flag来控制是否分页
Describe the solution you'd like
编写详细的使用说明书:
yaml examples:
Naive table:
dbengin: pgsql
tablename: test
fields:
- name: id
type: int
- name: name
type: string
Auto decide everything it can from meta tables
dbengin: pgsql
tablename: test
Write a design & using document for this project.
目前外键上的关联查询也要用户给我们sql才能生成,但外键上的关联查询还是很常见的,最好不要让用户提供sql
Describe the solution you'd like
让用户给出(或者查元表查出)外键对面的表的信息,自动生成相关api
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.