AWS AppSync 的基本语句
type Event {id: ID!name: Stringwhere: Stringwhen: Stringdescription: String# Paginate through all comments belonging to an individual post.comments(limit: Int, nextToken: String): CommentConnection }
AWS AppSync 是API的一种新标准;Schema是它的核心,SDL是Schema的主要语言。
schema {query: Querymutation: Mutationsubscription: Subscription }
- query 查询语句:
type Query {# Get a single event by id.getEvent(id: ID!): Event# Paginate through events.listEvents(filter: TableEventFilterInput, limit: Int, nextToken: String): EventConnection }
例子:
query{getEvent(id: "c16701cb-d614-4f21-b733-a636bc1c8437" ){descriptionname} }
返回 json:
{"data": {"getEvent": {"description": "test","name": "landen"}} }
2. mutation
type Mutation {# Create a single event.createEvent(name: String!,when: String!,where: String!,description: String!): Event# Delete a single event by id.deleteEvent(id: ID!): Event# Comment on an event.commentOnEvent(eventId: ID!, content: String!, createdAt: String!): Comment }
- createEvent 添加事件
mutation{createEvent(name: "landen",when: "2018-08-18",where: "guangdong",description: "today is rainny"){idname} }
返回 json:
{"data": {"getEvent": {"description": "test","name": "landen"}} }
- commentOnEvent 更改事件:
mutation{commentOnEvent(eventId: "c16701cb-d614-4f21-b733-a636bc1c8437",content: "comment : rainny",createdAt: "today"){eventId} }
返回 json:
{"data": {"commentOnEvent": {"eventId": "c16701cb-d614-4f21-b733-a636bc1c8437"}} }
- deleteEvent 删除事件:
mutation{deleteEvent(id: "c16701cb-d614-4f21-b733-a636bc1c8437"){name description} }
返回 json:
{"data": {"deleteEvent": {"name": "landen","description": "test"}} }
3. subscription 订阅事件:
type Subscription {subscribeToEventComments(eventId: String!): Comment@aws_subscribe(mutations: ["commentOnEvent"]) }
subscription{subscribeToEventComments(eventId:"b5a25e27-8416-4486-8df1-27c185520074"){content@aws_subscribe( mutations:["commentOnEvent"])}}
转载于:https://www.cnblogs.com/landen/p/9497825.html
AWS AppSync 的基本语句相关推荐
- aws appsync 理解和使用appsync为前端应用创建api接口
参考资料 https://docs.amazonaws.cn/appsync/latest/devguide/quickstart-launch-a-sample-schema.html 在 AWS ...
- aws数据库同步区别_了解如何通过使用AWS AppSync构建具有实时数据同步的应用程序
aws数据库同步区别 AWS AppSync automatically updates the data in web and mobile applications in real time, a ...
- 使用GraphQL,React Native和AWS AppSync编写应用程序代码:该应用程序
您将要创造的 在这些教程中,我将向您展示如何使用AWS AppSync和React Native创建GraphQL数据库并与之交互. 该应用程序将具有实时和脱机功能,我们通过AppSync开箱即用. ...
- 使用GraphQL,React Native和AWS AppSync编写应用程序代码:后端
您将要创造的 在这些教程中,我将向您展示如何使用AWS AppSync和React Native创建GraphQL数据库并与之交互. 该应用程序将具有实时和脱机功能,我们通过AppSync开箱即用. ...
- 画aws图_GraphQL和AWS AppSync的鸟瞰图
画aws图 Software engineers must pick the right API technology. GraphQL can be the best choice when it ...
- 如何将域名解析度aws_使用信息上下文的aws appsync条件解析器
如何将域名解析度aws AWS AppSync (AWS AppSync) AppSync is a managed GraphQL service offered by Amazon Web Ser ...
- AWS Appsync 的 variableMap 替换的智障算法问题
在AWS的AppSync中的请求模板中,如果用到了variableMap的功能,那么需要注意下面这个很坑的算法: 举例: 如有下面的请求映射模板(Request Mapping template) { ...
- appsync软件源_appsync lambda数据源的安全部署策略
appsync软件源 In this post we will walk through the options of running safe deployments of AppSync data ...
- AWS Amplify Console:赋予应用程序快速部署的能力
AWS re:Invent 2018大会发布了很多新功能和服务,包括新的AWS Amplify Console,一种针对移动Web应用程序的持续部署服务. AWS Amplify Console承诺可 ...
最新文章
- 操作系统结构-外核结构
- mysql复习增删改查
- 精通python爬虫框架-精通Python爬虫框架Scrapy PDF 中文清晰版
- Zabbix配置微信报警通知
- Spring Cloud构建微服务架构:分布式服务跟踪(入门)【Dalston版】
- 基本类型赋值和普通对象赋值的不同
- 计组之存储系统:6、Cache-主存映射方式(全相连映射、直接映射、组相连映射)
- 【英语学习】【Level 07】U06 First Time L5 A Different City
- Android 应用开发(37)---RelativeLayout(相对布局)
- 关于android:layout_weight
- 2017华为软件精英挑战赛思路分析
- Java5种算术运算符,Java算术运算符
- 华硕win10键盘失灵_win10笔记本键盘失灵
- 音王点歌系统怎么连接服务器,KTV音响设备怎么连接?点歌机怎么连接?学习下...
- 设备屏幕亮度调节代码实现
- 经济法基础——第五章第二节、个人所得税法律制度
- python生成单位阵或者对角阵的三种方法
- Android安装apk报错 问题记录
- 关于使用vue.js的模板渲染时出现一瞬间的设置的模板的解决方案
- 新研究评估Masimo SedLine(R)脑功能监护仪能否预测心跳骤停后ICU患者的神经系统转归和长期生存
热门文章
- AJAX控件使用教程
- 2018中国经济峰会上,这家中国原创耳机品牌双喜临门
- Unity与iOS原生代码之间的相互调用
- 将ntfs分区转换为ext4分区
- 飞机场100个常见公共标志英文单词
- 暗光增强论文Attention Guided Low-light Image Enhancement with a Large Scale Low-light Simulation Dataset翻译
- 使用HTML5和CSS3开发电子商务网站第一章HTLM5基础课后作业
- Elastic 安全 7.6.0 重磅发布
- 【自制数据集自动标注】yolo目标检测 voc格式 单调无遮挡背景单个物体自制数据集自动标注
- iPhone中如何获取当前输入法