GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - xyMrren/sqlrestful: Use SQL & Javascript to develop MicroServices of CloudNative

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

71 Commits
71 Commits

Folders and files

NameName
Last commit message
Last commit date
docs
docs
 
 
examples
examples
 
 
linux
linux
 
 
swagger2
swagger2
 
 
win
win
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
BUILD.md
BUILD.md
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
authorizer.go
authorizer.go
 
 
command.go
command.go
 
 
command_win.go
command_win.go
 
 
db.go
db.go
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
health.go
health.go
 
 
init.go
init.go
 
 
js.go
js.go
 
 
jwt.go
jwt.go
 
 
macro.go
macro.go
 
 
main.go
main.go
 
 
manager.go
manager.go
 
 
prep_noci8.go
prep_noci8.go
 
 
prep_nsqlite.go
prep_nsqlite.go
 
 
prep_oracle.go
prep_oracle.go
 
 
prep_sqlite3.go
prep_sqlite3.go
 
 
routes.go
routes.go
 
 
server_rest.go
server_rest.go
 
 
vars.go
vars.go
 
 

Repository files navigation

SQL转Restful微服务接口开发工具

设计初衷

一直在使用Java+SpringBoot作为微服务生产力工具,通常来讲实现一个Restful微服务接口需要做以下相关工作:

  • ORM映射实现:通常使用MyBatis,需要写Pojo类、Mapper类和SQLProvider类。
  • 服务层实现:需要一个对象管理接口类与一个对象管理实现类。
  • 控制层实现:一个RestConfoller类并注解Rest方法再调用服务层实现。
  • Devops配置:Dockerfile、k8s部署描述文件等等。

这样一个Restful接口实现下来至少需要5个以上的类,大部分工作是在做转换、校验等语言相关的工作。

我们可以想想从SQL到Restful经历了多少层的实现,而大部分工作是毫无意义的规则代码。。。

您可能会建议我使用spring-cloud云原生开发框架,但一样也少不上述过程。

因此一直以来,我一直想要有一个工具可以直接把SQL转成Restful微服务接口,同时它必须是云原生的开发方式:

  • 1、配置化实现:通过简单的配置边可以很方便的实现SQL转Restful接口;
  • 2、执行效率高:不能因为配置和转换减低运行效率;
  • 3、可容器化部署:能方便打包成Docker镜像并运行;
  • 4、多数据库支持:包括oracle、db2、mysql、postgres、hadoop等。

通过此工具可以快速对外提供Restful规范的数据微服务接口,满足碎片化的数据服务需求应用场景的快速响应。

说干就干,于是我找到了sqler,但是sqler仅支持REST而不支持完整的Restful规范。

因此我在其基础之上实现了一个完整的SQL转Restful接口的服务工具,兼容sqler配置语法的同时进行了Restful配置扩展实现。

感谢开源!

特色功能

  • 使用SQL及Javascript实现完整的Restful微服务接口
  • 内置Swagger接口文档界面(Swagger2.0支持)
  • 为Restful微服务接口提供内置的Redis缓存配置。
  • 配置脚本支持完整的Javascript ECMAScript 5.1规范
  • 动态查询实现提供器支持不同参数的SQL实现分支
  • 提供oci驱动支持Oracle数据库(参见【数据库支持列表】)

快速入门

  • SQLRestful开发入门示例
  • SQLRestful开发及配置说明
  • HCL配置语言快速入门

开箱示例

docker run -ti --rm -p 80:80 snz1/sqlrestful \
  --name sqlrestful \
  -driver "sqlite3" \
  -dsn "/tmp/tmp.db?create=true" \
  -debug 3 \
  -swagger \
  -config "/examples/sqlite.hcl"

此时打开http://127.0.0.1/swagger-ui.html查看示例实现接口文档。

示例截图

开箱即用的容器环境:


查看接口文档:


About

Use SQL & Javascript to develop MicroServices of CloudNative

neeker.github.io/sqlrestful

Resources

Readme
Apache-2.0 license
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.