1 Star 0 Fork 0

wenj91 / fastGQL

加入 Gitee
与超过 600 万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README.md

fastGQL

Realtime GraphQL on PostgreSQL / MySQL

About

This project exposes PostgreSQL / MySQL through GraphQL API, with built-in authorization engine. Inspired by Hasura.

This is alpha-version, with some features still in development:

  • basic operations
    • query
      • query_by_pk
      • query
      • query_count
      • query_aggregate
    • mutate
      • insert
      • update
    • delete
    • subscription
  • authorization engine configured with custom interceptor
  • user-defined filtering via GraphQL arguments
    • where
    • order by
    • limit
    • offset
    • distinct on(PostgreSQL: distinct on, MySQL: distinct)
  • integration graphql-spqr

Example

Full example

module: fastgql-example

Database

CREATE TABLE addresses(
  id INT PRIMARY KEY,
  street VARCHAR(255)
);

CREATE TABLE customers(
  id INT PRIMARY KEY,
  name VARCHAR(255),
  address INT REFERENCES addresses(id)
);

INSERT INTO addresses VALUES (0, 'Danes Hill');
INSERT INTO addresses VALUES (1, 'Rangewood Road');
INSERT INTO customers VALUES (0, 'Stacey', 0);
INSERT INTO customers VALUES (1, 'John', 0);
INSERT INTO customers VALUES (2, 'Daniele', 1);

CREATE TABLE `test` ( 
  `id` INT AUTO_INCREMENT NOT NULL,
  `name` VARCHAR(50) NULL DEFAULT NULL ,
  `age` INT NULL DEFAULT NULL ,
  `create_time` TIMESTAMP NULL DEFAULT current_timestamp() ,
  `update_time` TIMESTAMP NULL DEFAULT NULL ,
  CONSTRAINT `PRIMARY` PRIMARY KEY (`id`)
);

INSERT INTO `test` (`id`, `name`, `age`, `create_time`, `update_time`) VALUES (1, 'test', 111, '2021-07-24T01:09:42.000Z', NULL);
INSERT INTO `test` (`id`, `name`, `age`, `create_time`, `update_time`) VALUES (2, 'test2', 111, '2021-07-24T01:09:42.000Z', NULL);
INSERT INTO `test` (`id`, `name`, `age`, `create_time`, `update_time`) VALUES (3, 'test3', 111, '2021-07-24T01:09:42.000Z', NULL);


CREATE TABLE `t_user` ( 
  `id` INT AUTO_INCREMENT NOT NULL,
  `name` VARCHAR(50) NULL DEFAULT NULL ,
  `password` VARCHAR(100) NULL DEFAULT NULL ,
  `create_time` DATETIME NULL DEFAULT NULL ,
  `test_id` INT NULL DEFAULT NULL ,
  CONSTRAINT `PRIMARY` PRIMARY KEY (`id`)
);

INSERT INTO `t_user` (`id`, `name`, `password`, `create_time`, `test_id`) VALUES (1, 'user', 'password', NULL, 2);
INSERT INTO `t_user` (`id`, `name`, `password`, `create_time`, `test_id`) VALUES (2, 'test', 'password', NULL, 2);
INSERT INTO `t_user` (`id`, `name`, `password`, `create_time`, `test_id`) VALUES (13, 'test', 'password', NULL, 2);

Building and running

Development

Start Postgres container:

Start FastGQL in dev mode with hot reload:

Go to GraphQL Playground or query localhost:8888/graphql

Production

Build production bundle:

点评 ( 0 )

你可以在登录后,发表评论

简介

暂无描述 展开 收起
Java
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/wenj91/fastGQL.git
git@gitee.com:wenj91/fastGQL.git
wenj91
fastGQL
fastGQL
main

搜索帮助

105716 1d94204e 1850385 105716 2d26be5c 1850385