Unions are used when we want a GraphQL field or list to handle multiple types of data. With a Union Type, we can define a field that could resolve completely different types of data. In this lesson, we will write a query that obtains a list of different pet types

Unit type, we cannot use common field in query, I have to write in fragment:

# Write your query or mutation here
query {
familyPets {
__typename,
... on Cat {
name
},
... on Dog {
name
}
}
}

[GraphQL] Query Lists of Multiple Types using a Union in GraphQL的更多相关文章

  1. SpringBoot开发秘籍 - 集成Graphql Query

    概述 REST作为一种现代网络应用非常流行的软件架构风格受到广大WEB开发者的喜爱,在目前软件架构设计模式中随处可见REST的身影,但是随着REST的流行与发展,它的一个最大的缺点开始暴露出来: 在很 ...

  2. ASP.NET MVC报错: Multiple types were found that match the controller named

    当使用ASP.NET MVC的Area功能时,出现了这样的错误: Multiple types were found that match the controller named 'Home'. T ...

  3. Multiple types were found that match the controller named 'Auth'.

    偶然的一个机会,修改了已经开发完毕的一个项目的命名.突然运行发现: { "Message": "An error has occurred.", "E ...

  4. 爬取LeetCode题目——如何发送GraphQL Query获取数据

    前言   GraphQL 是一种用于 API 的查询语言,是由 Facebook 开源的一种用于提供数据查询服务的抽象框架.在服务端 API 开发中,很多时候定义一个接口返回的数据相对固定,因此要获得 ...

  5. [GraphQL] Query GraphQL Interface Types in GraphQL Playground

    Interfaces are similar to Unions in that they provide a mechanism for dealing with different types o ...

  6. [GraphQL] Use Arguments in a GraphQL Query

    In GraphQL, every field and nested object is able to take in arguments of varying types in order to ...

  7. [GraphQL] Query a GraphQL API with graphql-request

    To query a GraphQL API, all you need to do is send an HTTP request that includes the query operation ...

  8. [GraphQL] Use GraphQLList with GraphQLObject Types

    When working with collections of things in GraphQL, we'll always reach out for the GraphQLListType. ...

  9. SQLite Learning、SQL Query Optimization In Multiple Rule

    catalog . SQLite简介 . Sqlite安装 . SQLite Programing . SQLite statements 1. SQLite简介 SQLite是一款轻型的数据库,是遵 ...

随机推荐

  1. SecureCRT系列:生成公私钥

    SecureCRT下载地址:http://www.portablesoft.org/securecrt-securefx-legacy-versions/1.打开我们的SecureCRT客户端,点击t ...

  2. Linux基础-01-Linux基础命令

    1. Linux命令的格式 1) Linux命令的语法格式: 命令 [选项] [参数] 2) 命令格式中命令.选项.参数的具体含义 a) 命令:告诉Linux(UNIX)操作系统做(执行)什么. b) ...

  3. python内置模块介绍(一)

     本文主要介绍模块列表如下: os sys re time datetime random shutil subprocess os模块 os.getcwd()                    ...

  4. go 数据渲染到终端 01

    package main import ( "fmt" "text/template" "os" ) type Person struct ...

  5. (转)FFMPEG 实现 YUV,RGB各种图像原始数据之间的转换(swscale)

    雷霄骅分类专栏: FFMPEG FFmpeg 本文链接:https://blog.csdn.net/leixiaohua1020/article/details/14215391 FFMPEG中的sw ...

  6. Linux上安装pstree命令(-bash: pstree: command not found)

    一.pstree命令的安装 1.在 Mac OS上 brew install pstree 2.在 Fedora/Red Hat/CentOS yum -y install psmisc 3.在 Ub ...

  7. redis列表数据类型---list

    一.概述 redis列表是简单的字符串列表,按照插入顺序排序 可以添加一个元素到列表的头部(左边)或者尾部(右边) 一个列表最多可以包含2^32-1个元素(每个列表超过40亿个元素). 二.redis ...

  8. Java帖子

    IDEA新手使用教程(详解):https://cloud.tencent.com/developer/article/1448115 Java学习文档:https://www.sxt.cn/Java_ ...

  9. Modelsim问题集锦

    前言 收集工程调试中遇到的modelsim问题. 问题 (1)仿真发现时钟信号和理论上的数据信号没有边沿对齐. 解决:一般是时钟精度不匹配的问题. 如果想要1ns的精度则代码中的精度需设置为: v语法 ...

  10. springboot学习入门简易版一---springboot2.0介绍

    1.1为什么用springboot(2) 传统项目,整合ssm或ssh,配置文件,jar冲突,整合麻烦.Tomcat容器加载web.xml配置内容 springboot完全采用注解化(使用注解方式启动 ...