• hasura graphql-engine v1.0.0-alpha26 版本新功能试用


    hasura graphql-engine v1.0.0-alpha26 已经发布了,有好多新的变动,测试使用docker 环境,同时pg 数据库使用了citus

    citus 是一个方便扩展的pg 数据库扩展解决方案,很不错。

    环境准备

    docker-compose && citus

    • docker-compose 文件
    version: '2.1'
    
    services:
      graphql-engine:
        image: hasura/graphql-engine:v1.0.0-alpha26
        ports:
        - "8080:8080"
        command: >
          /bin/sh -c "
          graphql-engine --database-url postgres://postgres@master/postgres serve --enable-console;
          "
      master:
        container_name: "${COMPOSE_PROJECT_NAME:-citus}_master"
        image: 'citusdata/citus:7.5.1'
        ports: ["${MASTER_EXTERNAL_PORT:-5432}:5432"]
        labels: ['com.citusdata.role=Master']
      worker:
        image: 'citusdata/citus:7.5.1'
        labels: ['com.citusdata.role=Worker']
        depends_on: { manager: { condition: service_healthy } }
      manager:
        container_name: "${COMPOSE_PROJECT_NAME:-citus}_manager"
        image: 'citusdata/membership-manager:0.2.0'
        volumes: ['/var/run/docker.sock:/var/run/docker.sock']
        depends_on: { master: { condition: service_healthy } }
    • 启动
    docker-compose up -d

    • 测试数据表
    -- DDL generated by Postico 1.4.2
    -- Not all database features are supported. Do not use for backup.
    
    -- Table Definition ----------------------------------------------
    
    CREATE TABLE citus.userlogin (
        id integer DEFAULT nextval('citus.userlogin_id_seq'::regclass) PRIMARY KEY,
        username text NOT NULL,
        userage integer NOT NULL
    );
    
    -- Indices -------------------------------------------------------
    
    CREATE UNIQUE INDEX userlogin_pkey ON citus.userlogin(id int4_ops);
    
    -- DDL generated by Postico 1.4.2
    -- Not all database features are supported. Do not use for backup.
    
    -- Table Definition ----------------------------------------------
    
    CREATE TABLE citus.platformuser (
        id integer DEFAULT nextval('citus.platformuser_id_seq'::regclass) PRIMARY KEY,
        platformtype text NOT NULL,
        loginuser integer NOT NULL DEFAULT nextval('citus.platformuser_loginuser_seq'::regclass),
        platformname text NOT NULL
    );
    
    -- Indices -------------------------------------------------------
    
    CREATE UNIQUE INDEX platformuser_pkey ON citus.platformuser(id int4_ops);
    

    新功能测试

    • order_by 查询
    query {
       citus_userlogin(order_by:{id:asc}) {
        id
        username
        userage
      }
    }
    • 聚合参数操作
    query {
       citus_userlogin_aggregate {
         aggregate {
           max {
            userage
          }
        }
      }
    }


    • 关系聚合


    • event trigger

    说明

    测试只是一部分,实际上还有预设值的,都比较简单,hasura graphql-engine 是越来越方便了,hasura 团队很给力,
    对于开发来说太方便了

    参考资料

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

  • 相关阅读:
    【python】元组
    【python】列表
    1-读书的网站
    35-Python
    34-TypeError: BoxSizer.AddSpacer(): argument 1 has unexpected type 'tuple'
    33-wxpython多个frame之间的信息共享
    32-python代码打包成exe文件-pyinstaller
    31-字符串转为 url 格式的两种不同情况
    30-python3 中 bytes 和 string 之间的互相转换
    9-eclispe中右键BuildPath没有了
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/9862129.html
Copyright © 2020-2023  润新知