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
API を Firebase Realtime Database に移行して気付いたこと
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
syamaoka
August 28, 2017
Technology
800
1
Share
API を Firebase Realtime Database に移行して気付いたこと
syamaoka
August 28, 2017
More Decks by syamaoka
See All by syamaoka
API を Firebase Realtime Database に移行して気付いたこと ver2
bpyamasinn
1
510
Other Decks in Technology
See All in Technology
猫でもわかるKiro CLI(CDKコーディング編)
kentapapa
1
120
AIエージェントを構築して感じた、AI時代のCDKとの向き合い方
smt7174
1
250
目的ファーストのハーネス設計 ~ハーネスの変更容易性を高めるための優先順位~
gotalab555
7
1.9k
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」ご紹介資料
laysakura
0
3.8k
CDK Insightsで見る、AIによるCDKコード静的解析(+AI解析)
k_adachi_01
2
180
3つのボトルネックを解消し、リリースエンジニアリングを再定義した話
nealle
0
540
The Journey of Box Building
tagomoris
4
300
2026年に相応しい 最先端プラグインホストの設計<del>と実装</del>
atsushieno
0
130
Data Hubグループ 紹介資料
sansan33
PRO
0
2.9k
20260415_生成AIを専属DSに_自動レポート作成_ハンズオン_交通事故データ
doradora09
PRO
0
110
CloudSec JP #005 後締め ~ソフトウェアサプライチェーン攻撃から開発者のシークレットを守る~
lhazy
0
220
え!?初参加で 300冊以上 も頒布!? これは大成功!そのはずなのに わいの財布は 赤字 の件
hellohazime
0
150
Featured
See All Featured
So, you think you're a good person
axbom
PRO
2
2k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
510
Thoughts on Productivity
jonyablonski
76
5.1k
The Spectacular Lies of Maps
axbom
PRO
1
690
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
100
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1k
WCS-LA-2024
lcolladotor
0
530
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
190
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Transcript
API Λ Firebase Realtime Database ʹҠߦͯ͠ؾ͍ͨ͜ͱ 2017/08/28 syamaoka GCPUG Firebase
Realtime Database /meetup/1
ࣗݾհ ໊લɿ ࢁԬ ਅ (syamaoka) झຯɿ ɾ MMO RPG ɾ
PC : Tales Weaver ɾ Mobile : Lineage 2 Revolution ɾ MoBA : VainGlory ୲ɿ ɾ iOS, όοΫΤϯυ (API, Batch)
୲தαʔϏεͰꙍ ֵአͭͼ͚Ρ䱛ᚆ • Realtime Database • Remote Config • Firebase
Authentication • Analytics • App Indexing • Firebase Performance Monitoring
୲தαʔϏεͰꙍ ֵአͭͼ͚Ρ䱛ᚆ • Realtime Database <- ࠓ͜͜Λத৺ʹ͠·͢ ! • Remote
Config • Firebase Authentication • Analytics • App Indexing • Firebase Performance Monitoring
ΞδΣϯμ • API -> Firebase Realtime Database • ΞϓϦଆͷ࣮ •
ηΩϡϦςΟϧʔϧʹ͍ͭͯ
Firebase ʹٻΊ͍ͯΔ͜ͱ • API ࡞ͷܰݮ • ύϑΥʔϚϯενϡʔχϯά͔Βͷ٫ • ΦϑϥΠϯ࣌ͷσʔλͷѻ͍͢͞ʢॲཧͷ؆୯͞ʣ
API -> Firebase Realtime Database
Ұ൪ࠔͬͨʢࠓෆ҆ʣͷɺ ߹ੑ !
݁
ΞϓϦέʔγϣϯίʔυΛ৴͡ΔʢఘΊʣ Firebase RDB Ͱͳ͍ͨΊɺ֎෦Ωʔ੍͕ͳ͍ɻ ͦͷͨΊɺ݁߹͕ඞཁͳՕॴొ͢ΔࡍʹίʔυͰ֬ೝɻ εΩʔϚϨε(Ұ؏ੑ͕ͳ͍)Ͱɺ݁߹͖͔͢൱͔Λஅ͠ɺ ࠷దͳઃܭΛ͍ͯ͘͠ͷ͕ॏཁɻ ! ΤϯδχΞͷͷݟͤॴ
!
ιʔτͷಛ • ΩʔΛࢦఆͯ͠ঢॱͰऔಘ • ฦ٫͢Δσʔλͷॱ൪อূ͍ͯ͠ͳ͍
ιʔτͷಛ • ΩʔΛࢦఆͯ͠ঢॱͰऔಘ • ฦ٫͢Δσʔλͷॱ൪อূ͍ͯ͠ͳ͍
ฦ٫͢Δσʔλͷॱ൪อূ͍ͯ͠ͳ͍ ྫ͑ created_at Ͱιʔτ͠ɺ ࠷৽σʔλΛ 10 ݅औಘͨ࣌͠ɺ ฦ٫͞ΕΔσʔλ࠷৽σʔλͷ 10 ͕݅ͩɺ
ฦ٫͞ΕΔ JSON ͷฒͼॱอূ͞Ε͍ͯͳ͍
None
Q. ͭ·ΓΞϓϦଆͲ͏͢Ε͍͍ʁ A. ฦ٫͞ΕͨΛιʔτ͢͠ɻ
߱ॱʹ͢Δʹʁ • created_at Λ - ͷʹͯ͠ɺ߱ॱʹͳΔ key Λੜ https://stackoverflow.com/questions/34156996/firebase- data-desc-sorting-in-android/42572025#42572025
• શ݅औಘͯ͠ΞϓϦଆͰ߱ॱʹฒͼସ͑Δ • QueryLastTo Λͬͯ࠷ޙͷσʔλ͔Βऔಘ͢Δ
ϩδοΫॱʹ͢Δʹʁ ϩδοΫʹΑΔฒͼॱɺ Firebase Realtime Database ͚ͩͰ͍͠ɻ
ιʔτ༻ͷσʔλΛ࡞ { "articleOrders": { "articleId1": 1, "articleId2": 2 } }
ϝϦοτ • ࠷খݶͷࢀর • ΞϓϦͷมߋͳ͠ʹཪଆͰॱ൪Λมߋग़དྷΔ ※ articles ͷதʹ order Λ༻ҙͨ͠߹ɺarticles
શͯΛಡ ΈࠐΉඞཁ͕͋ΓɺύϑΥʔϚϯε͕ѱ͍ ❌
σϝϦοτ • ߋ৽ִ͕ؒ͘ग़དྷͳ͍ • ̍࣌ؒຖʹߋ৽ͱ͔Ͱ͋Εେৎ͕ͩɺ5ຖͱ͔ͩͱ ͖ͬͱݫ͍͠ • ܭࢉରͷσʔλྔʹݶք͕͋Δ
Cloud Function ͱ͍ ͚Α͏ !
Rule ʹ͍ͭͯ
Rule େମҎԼͷ̐ͭ • Read and Write • Type • Require
• index
ܕͷࢦఆํ๏ { "article": { "title": { ".validate": "newData.isString()" }, "visible":
{ ".validate": "newData.isBoolean()" } } }
ඞਢύϥϝʔλͷࢦఆํ๏ { "article": { ".validate": "newData.hasChildren(['title','visible'])" } }
Index ͷࢦఆํ๏ { "article": { ".indexOn": [ "title" ] }
}
γϛϡϨʔλ͕͍͢͝ศར !
Demo
͔͠͠ɺ͜ΕΛखೖྗͰ શ෦ཧ͢Δͷେม !
None
⚠ 8/28 ࣌ β ver
Demo
ઃఆϑΝΠϧ https://gist.github.com/bpyamasinn/ c1f62153f0bea8a499c111f4f30c8546
Index ͷઃఆ͚ͩগ͔͍ͬ͠ Index Path Ͱࢦఆ͠ͳͪ͘Ό͍͚ͳ͍ͨΊɺ Type ʹهࡌग़དྷͳ͍ͨΊɺδΣωϦΫεΛͬͯఆٛͨ͠ࡍʹ ៉ྷʹॻ͚ͳ͍෦͕ग़ͯ͘Δ !
Client Side Join
σʔλྫ { "articles" : { "hogeId" : { "title" :
"λΠτϧ", "category" : "categoryID_1" } }, "categories" : { "categoryID_1" : { "name": "ήʔϜ" } } }
ํ๏ RxSwift ͷ zip Λ༻͍ͯϚʔδ͢Δ
݁߹ͷྲྀΕ 1. articles ͱ categories Λฒྻʹऔಘ 2. RxSwift ͷΦϖϨʔλ zip
Λ༻͍ͯɺ྆ํͷσʔλΛऔಘ͢Δ 3. ྆σʔλΛ݁߹͢Δ
ΞϓϦଆͰͷιʔτߜΓࠐΈ ެࣜυΩϡϝϯτʹهࡌ͞Ε͍ͯΔ௨Γɺ ΫϥΠΞϯταΠυͰͷιʔτϑΟϧλϦϯάਪ͞Εͯ ͍ͳ͍ ❌
ΞϓϦଆͰॲཧग़དྷͳ͍ͷɺ όονͰσʔλΛ༻ҙ͢Δ !
࣍·ͨϦϦʔεޙʹൃද͠·͢ !