Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Persisted-queryをやってみた
Search
indigolain
August 28, 2020
Technology
1.4k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Persisted-queryをやってみた
GraphQL Tokyo #10 発表資料
indigolain
August 28, 2020
More Decks by indigolain
See All by indigolain
スタディサプリにおける TypeScript 活用事例と今後の展望 / jsconf-jp-2021
indigolain
3
6.2k
フロントエンドチーム立ち上げで学んだTips / What I learned from organizing the new frontend team
indigolain
0
2.8k
TEC DEPT 201610 Catal Engineer5期生募集
indigolain
0
500
なるほどUNIXプロセス14_15章
indigolain
0
180
なるほどUNIXプロセス10~11章
indigolain
0
160
なるほどUNIXプロセス4~5章
indigolain
0
190
Other Decks in Technology
See All in Technology
長期運営で肥大化したExcelマスターデータの解消に向けた移行事例
gree_tech
PRO
0
100
案件に一番詳しいAIを Amazon Bedrock AgentCore で作る ― 知見が知見を生むチームへ / Compounding Knowledge with AgentCore
yusukeshimizu
1
170
Android skills に学ぶ
kokiko
0
150
【CEDEC2026】Creative Approaches to Localizing the Dialects and Unique Speech of Umamusume: Pretty Derby Characters in English
cygames
PRO
4
26k
現場回帰したデータエンジニアが考える AI 時代のキャリア開発 / Career Development in the Age of AI Perspectives from a Hands-on Data Engineer
medley
0
310
平文パスワードはログに“残り” ── 肝心の侵入は“痕跡すら残らない”
kuroneko13
0
120
Rust×eBPFでEDRっぽいものをつくる
sunlife3
2
820
ホームラボ紹介
y_sera15
0
230
Oracle MCP Servers Explained
thatjeffsmith
0
410
dbt in Microsoft Fabric
ryomaru0825
0
120
作って理解するCoding Agent 〜フレームワークに頼らないピュア Python での実装〜
takapy
3
1k
AIにブラウザを触らせて、E2EテストをPlaywrightで書く
koji_kawamura
0
350
Featured
See All Featured
Writing Fast Ruby
sferik
630
63k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Raft: Consensus for Rubyists
vanstee
141
7.6k
KATA
mclloyd
PRO
35
15k
The untapped power of vector embeddings
frankvandijk
2
1.8k
Designing for Performance
lara
611
70k
First, design no harm
axbom
PRO
2
1.3k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.5k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Transcript
Persisted-queryをやってみた @indigolain
Who am I? • indigolain / 上原拓也 • Rails /
React / GraphQL • 最近個人プロジェクトでUnityで3Dサウンドを使ったゲーム を作ろうと試行錯誤しています
Automatic Persisted Queries • Apolloが提供しているPersisted Queryの仕組み • リクエストを小さくする、もしくはcacheを使うことを目的としたもの ◦ 望まないクエリの排除などの機能はない
• apollo-server, apollo-clientなどapolloなライブラリを組み合わせると ある程度動くものがさらっとできます
Automatic Persisted Queries https://www.apollographql.com/docs/apollo-server/performance/apq/
Automatic Persisted Queries https://www.apollographql.com/docs/apollo-server/performance/apq/
Automatic Persisted Queries https://www.apollographql.com/docs/apollo-server/performance/apq/
Automatic Persisted Queries https://www.apollographql.com/docs/apollo-server/performance/apq/
Automatic Persisted Queries https://www.apollographql.com/docs/apollo-server/performance/apq/
Automatic Persisted Queries https://www.apollographql.com/docs/apollo-server/performance/apq/
すごい、便利
でも・・・ • 登録されているクエリ-ハッシュのペアをコードで管理したい • 登録されるクエリ-ハッシュのペアをレビューできるようにして、どのような クエリが呼ばれる可能性があるのか把握したい リクエストされるクエリを把握し、 新しく送られるクエリについてPRなどで議論できるようにしたい
でも・・・ クライアントのコードから クエリ-ハッシュがペアになっている JSONを自動生成できるようになれば コード化 && レビュー できるのでは • 登録されているクエリ-ハッシュのペアをコードで管理したい
• 登録されるクエリ-ハッシュのペアをレビューできるようにして、どのような クエリが呼ばれる可能性があるのか把握したい
{ "version": 2, "operations": [ { "signature": "e5f…...", "document": "query
UpdateQuery….", "metadata": { "engineSignature": "" } }, ….. ] } query UpdateQuery($courseId: ID!) { updateQuery(id: $id) { …... } } Query JSON apollo client:extract https://github.com/apollographql/apollo-tooling#apollo-clientextract-output query UpdateQuery2($courseId: ID!) { updateQuery2(id: $id) { …... } } JSON生成 & PR化
JSONを参照して hash → クエリする処理 https://www.apollographql.com/docs/apollo-server/performance/apq/
None
None
None
None
None
TODO • 生成したJSONの管理の仕方 ◦ NativeアプリのバージョンによってJSONを分離する? ◦ Nativeクライアントの種類によってJSONを分離する? • etc…. 話したこと
• ApolloのAutomatic Persisted Queriesの仕組みを活用しつつ、 persistするクエリをJSONで自由に登録できるようにした • JSONで発行されるクエリをコード化することによって、クライアントから呼 ばれるクエリをレビューするための仕組みができた
fin