hasura graphql-engine v1.0.0-alpha30 功能试用

hasura graphql-engine v1.0.0-alpha30 有好多新的功能的添加

环境准备

  • docker-compose 文件
version: '3.6'
services:
  postgres2:
    image: postgres:9.6
    ports:
    - "5432:5432"
    environment:
    - "POSTGRES_PASSWORD:dalong"
    volumes:
    - ./db_data2:/var/lib/postgresql/data
  postgres:
    image: postgres:9.6
    ports:
    - "5435:5432"
    environment:
    - "POSTGRES_PASSWORD:dalong"
    volumes:
    - ./db_data:/var/lib/postgresql/data
  benthos:
    image: jeffail/benthos
    volumes:
    - "./configs/webhook.yaml:/benthos.yaml"
    ports:
    - "4195:4195"
  graphql-engine2:
    image: hasura/graphql-engine:v1.0.0-alpha30
    ports:
    - "8080:8080"
    depends_on:
    - "postgres"
    environment:
    - "POSTGRES_PASSWORD:dalong"
    command: >
      /bin/sh -c "
      graphql-engine --database-url postgres://postgres:dalong@postgres2:5432/postgres serve --enable-console;
      "
  graphql-engine:
    image: hasura/graphql-engine:v1.0.0-alpha29
    ports:
    - "8090:8080"
    depends_on:
    - "postgres"
    environment:
    - "POSTGRES_PASSWORD:dalong"
    command: >
      /bin/sh -c "
      graphql-engine --database-url postgres://postgres:dalong@postgres:5432/postgres serve --enable-console;
      "

说明: 次文件可能少有苏复杂,集成了webhook(events) 以及多个版本的graphql 引擎

  • 启动
docker-compose up  -d

试用

  • 界面变动
    hasura graphql-engine v1.0.0-alpha30 功能试用_hasura graphql-engin
  • 破坏性的排序变动
    可以参考上面的查询,desc
  • distinct on 支持
    hasura graphql-engine v1.0.0-alpha30 功能试用_hasura graphql-engin_02
    hasura graphql-engine v1.0.0-alpha30 功能试用_hasura graphql-engin_03
  • 模式拼接
    使用连个graphql 引擎,但是报错了,很正常,类型有相同的,从当前来说,使用起来还是不太方便,可以使用graphql-binding 去解决
    这个官方也提供了demo
    hasura graphql-engine v1.0.0-alpha30 功能试用_hasura graphql-engin_04
    一个模式拼接的说明图
    hasura graphql-engine v1.0.0-alpha30 功能试用_hasura graphql-engin_05

参考资料

https://github.com/hasura/graphql-engine/releases
https://docs.hasura.io/1.0/graphql/manual/index.html