{"id":24669139,"url":"https://github.com/pymongo/warp_graphql_demo","last_synced_at":"2026-06-23T03:31:42.845Z","repository":{"id":105529467,"uuid":"306511494","full_name":"pymongo/warp_graphql_demo","owner":"pymongo","description":"async-graphql+warp","archived":false,"fork":false,"pushed_at":"2020-10-28T07:17:49.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-13T19:17:37.525Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pymongo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-10-23T02:40:32.000Z","updated_at":"2022-04-17T22:30:12.000Z","dependencies_parsed_at":"2023-07-22T23:15:48.376Z","dependency_job_id":null,"html_url":"https://github.com/pymongo/warp_graphql_demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pymongo/warp_graphql_demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pymongo%2Fwarp_graphql_demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pymongo%2Fwarp_graphql_demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pymongo%2Fwarp_graphql_demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pymongo%2Fwarp_graphql_demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pymongo","download_url":"https://codeload.github.com/pymongo/warp_graphql_demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pymongo%2Fwarp_graphql_demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34674702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-26T09:19:40.645Z","updated_at":"2026-06-23T03:31:42.826Z","avatar_url":"https://github.com/pymongo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraphQL笔记\n\nGraphQL isn't tied(绑定) to any specific database or store engine\n\n## schema简介\n\n想用graphql就必须要有一个全局变量/单例模式Schema(例如用OnceCell wrap Schema)\n\n而Schema由3个部分组成，其中Query是required的，而Mutation和Subscription可以为空，例如async_graphql::EmptySubscription\n\nQuery部分可以理解为CRUD的R，Mutation则包括对数据的增删改，Subscription一般通过WebSocket实现数据发生变动后推送给订阅的客户端(LiveData)\n\nuse async_graphql::Object之后就会包含Object和field两个过程宏(filed过程宏在2.0版本已被删除?，改名为#[graphql])\n\n## types\n\ngrapqhl basic scalar types: String, Int(i32), Float(f32), Boolean, and ID\n\n类型后接个叹号表示NonNull，所以如果下面例子中的value是Optional，则类型Float后面不会接上叹号\n\n```\ntype ValueAndChangeRate {\n  value: Float!\n  changeRate: Float!\n}\n```\n\n## Graphql通信\n\nRequest和Response的消息格式都是: Content-Type: application/json\n\nRequest会用POST请求将json数据携带在payload中: `{query: \"{hello}\", variables: null}`\n\n### warp graphql路由\n\n一定要先写playground再or post，`graphql_post.or(graphql_playground)`这种写法连playground页面都进不了\n\n## Graphql携带变量\n\n\u003e curl -X POST -H \"Content-Type: application/json\" -d '{\"query\": \"query($a: Int!){add(a:$a,b:1)}\", \"variables\": {\"a\": 1}}' http://localhost:8003\n\n如果没有变量，可以将`query{add(a:1,b:1)}`省去外层的query(因为默认就当做是query?)\n\n如果携带了变量，一定要在query内定义好变量名和类型，例如`query{add()}``\n\n前端payload如果定义了变量但是没有使用就会报错variables is not used，如果没有定义变量但是payload的variables字段多传了变量参数则没有问题\n\n---\n\n## English words\n\n### English(graphql)\n\n- exclamation point: 感叹号\n\n### English(other)\n\n- criminal and civil: 刑事和民事\n- handicapped: 残疾地\n- scams: 骗局\n- worshippers: 信徒\n- threat: 恐吓","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpymongo%2Fwarp_graphql_demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpymongo%2Fwarp_graphql_demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpymongo%2Fwarp_graphql_demo/lists"}