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
家計簿管理システム Midas について / balance system Midas
Search
firedial
September 25, 2019
Programming
1
230
家計簿管理システム Midas について / balance system Midas
趣味で作った家計簿管理システムについて。
API 側の Golang をメインに紹介した。
firedial
September 25, 2019
Tweet
Share
More Decks by firedial
See All by firedial
SSL のハンドシェイクについて
firedial
0
320
Other Decks in Programming
See All in Programming
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
300
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
Запуск 1С:УХ в крупном энтерпрайзе: мечта и реальность ПМа
lamodatech
0
560
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
7
1.5k
Оптимизируем производительность блока Казначейство
lamodatech
0
560
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
300
Androidアプリのモジュール分割における:x:commonを考える
okuzawats
1
220
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
580
快速入門可觀測性
blueswen
0
420
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
240
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
300
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
1k
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
Docker and Python
trallard
42
3.2k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Facilitating Awesome Meetings
lara
50
6.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Producing Creativity
orderedlist
PRO
342
39k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Testing 201, or: Great Expectations
jmmastey
41
7.1k
Fireside Chat
paigeccino
34
3.1k
The World Runs on Bad Software
bkeepers
PRO
66
11k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Transcript
ՈܭཧγεςϜ Midas ʹ͍ͭͯ firedial DesignOne Go #5 September 25, 2019 firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 1 / 28
ࣗݾհ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 2 / 28
ࣗݾհ ໊લ: firedial ੜޙ: 9829 ग़: ࣎լݝ झຯ: ϏϦϠʔυɺֶɺࢄࡦɺ٤ళۦಈ։ൃ ࠷ۙݟ͚ͭͨެࣜ: n ∑ k=0 (−1)k n Ck kn+m = n+m Pn tm (n) tm (n) := lim x→0 dm dxm ( ex − 1 x ) n firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 3 / 28
ࣗݾհ ࠓ·Ͱ৮Ε͖ͯͨओͳݴޠ (ख़͍ͯ͠Δͱݴ͍ͬͯͳ͍) C (3 ) PHP (2 ) C++ (1 ) VBA (1 ) Haskell () Elm () Golang () Ruby on Rails (3 ϲ݄) firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 4 / 28
࠷ۙͨ͠ۦಈ։ൃ ࠷ۙͨ͠ۦಈ։ൃ... firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 5 / 28
ࢁۦಈ։ൃ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 6 / 28
Πϯελө͑ ͢Έ·ͤΜɺຊࢁͰ։ൃ͍ͯ͠·ͤΜɻ શʹΠϯελө͑ૂ͍ͬͯ·ͨ͠ɻ Πϯελ͍ͬͯ·ͤΜɻ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 7 / 28
Midas ͷհ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 8 / 28
Midas ͷ֓ཁ Midas (ϛμε) ͱՈܭཧγεςϜͷ͜ͱͰ͋Δɻ ཧ͢ΔใҎԼͷͷͰ͋Δ (balance ςʔϒϧ)ɻ ֹۚ (-500 ԁ) ߲ (͏ͲΜ) छผ (ன͝Μ) ༧ࢉ (৯අ) ॴ (ࡒ) (2019/9/14) छผɺ༧ࢉɺॴ ID Խ͞Ε͍ͯΔ (attribute ςʔϒϧ)ɻ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 9 / 28
Midas ͷઆ໌ ϑϩϯτ: Elm API: Golang (Gin ϑϨʔϜϫʔΫ) DB: MySQL ϦόʔεϓϩΩγ: Nginx firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 10 / 28
Elm ͱͳʹ͔ Elm ͱ AltJs ͷҰछͰɺؔܕݴޠͰ͋Δɻ Elm ༗໊ͳͷͰɺΈͳ͞Μ͝ଘͰ͢ΑͶʁʁʁ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 11 / 28
Elm ͱͳʹ͔ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 12 / 28
Elm ͱͳʹ͔ ͦ͏ɺԿΛӅͦ͏ɺ ࠓߋֶͳ͍͍ͯ͘ݴޠ1Ґ Ͱ͢ʂʂʂʂ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 13 / 28
ؓٳ ؓٳ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 14 / 28
ߏਤ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 15 / 28
Misuzu ʹ͍ͭͯ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 16 / 28
Misuzu ͷઆ໌ Misuzu ͷ API ͰͰ͖Δ͜ͱ औಘ ▶ balance ςʔϒϧ ▶ attribute ςʔϒϧ ૠೖ ▶ balance ςʔϒϧ ▶ ༧ࢉͱॴͷҠಈ (balance ςʔϒϧʹ 2 Ϩίʔυૠೖ) ूܭ ▶ छผ (·ͨ༧ࢉॴ) ͷ ID ผͷ߹ܭ ▶ ผͷ߹ܭ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 17 / 28
ґଘؔਤ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 18 / 28
firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 19 / 28
Midas ʹ͕͋ͬͨɻͦ͏ɺೝূΛ͍ͯ͠ͳ͍ͷͰ͋Δɻ ༑ਓʹ wi-fi Λିͨ࣌͠ɺ http://192.168.1.6:8080/api/v1/sum/ Λୟ͔ΕΔͱશࡒ࢈͕औಘͰ͖ͯ͠·͏...ɻ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 20 / 28
ೝূ ͱ͍͏͜ͱͰɺೝূγεςϜΛ࡞Γ·͠ΐ͏ɻ ࠓճ Authorization ϔομʔΛͬͨೝূΛ͢Δ (RFC7235)ɻ ϦΫΤετϔομʔʹɺ Authorization: Bearer access token ΛೖΕɺ access token ʹΑͬͯೝূΛߦ͏ํࣜɻ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 21 / 28
ೝূ Listing 1: main.go 1 func main() { 2 r := gin.Default() 3 r.Use(Auth()) 4 // (ommited) 5 r.Run() 6 } 7 8 func Auth() gin.HandlerFunc { 9 return func(c *gin.Context) { 10 token := c.Request.Header.Get("Authorization") 11 12 if token != "Bearer token" { 13 c.AbortWithStatus(401) 14 } 15 c.Next() 16 } 17 } firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 22 / 28
࣮ԋ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 23 / 28
࣮ԋ ࣮ࡍʹݟ͍͖ͯͨͩ·͢ɻ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 24 / 28
͜ΕͰ ͜ΕͰɺ༑ਓ͕དྷͨ࣌҆৺ͯ͠ wi-fi Λି͢͜ͱ͕Ͱ͖·͢ʂ (͑ͬʁ SSL Խ௨৴͍ͯ͠ͳ͍ͬͯʁ ܅ͷΑ͏ͳצͷ͍͍ΨΩ ݏ͍ͩΑ) firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 25 / 28
·ͱΊ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 26 / 28
·ͱΊ ·ͱΊ ▶ ΒΕͨ͘ͳ͍ใͷೝূେʂ ▶ Midas DB ϑϩϯτ API ͳͲΛࣗͰઃܭͰָ͖͍ͯ͠ ࠓޙͷల։ (Midas) ▶ ·ͩ·ͩϑϩϯτ͕શવͳͷͰͦ͜Λॆ࣮͍͖͍ͤͯͨ͞ ▶ Docker Ͱىಈ͍ͤͨ͞ ࠓޙͷల։ (Golang) ▶ ରہ࣌ܭͷϓϩάϥϛϯά͕͍ͨ͠ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 27 / 28
ιʔείʔυ Misuzu (Golang): https://github.com/firedial/midas-misuzu Nagisa (Elm): https://github.com/firedial/midas-nagisa firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 28 / 28