Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TinyGoで使えるORM sqllaの 紹介とTinyGoで使えるようにするための工夫

mackee
October 13, 2023

TinyGoで使えるORM sqllaの 紹介とTinyGoで使えるようにするための工夫

mackee

October 13, 2023
Tweet

More Decks by mackee

Other Decks in Programming

Transcript

  1. ୭ • @mackee_w at Twitter(formally X), @mackee at GitHub •

    ໘ന๏ਓΧϠοΫ (ຊ೔ח૔͔Βདྷ·ͨ͠ʂ) • ISUCON11༏উ • ISUCON12༧બ ग़୊(SQLiteͷ΍ͭͰ͢) • ීஈ͸PerlίϛϡχςΟͰ฻Β͍ͯ͠·͢ ͕࢓ࣄ͸΄ͱΜͲGoͰ͢ • YAPC::Hiroshima͍ͬͯ͏Ξπ͍Πϕϯτ͕དྷ೥݄̎ʹ͋ΔͷͰདྷͯ͘Εʂʂʂ
  2. sqlla ͱ͍͏ORMΛ࡞͍ͬͯ·͢ • ΧϥϜʹରԠ͢Δϝ ιουΛੜ੒ͯ͠ SQLΛGoͷจ๏Ͱॻ ͚ΔΫΤϦϏϧμʔ • re fl

    ectΛ༻͍ͳ͍ ίʔυੜ੒ʹΑΔ structϚοϐϯά ࢓ࣄͰ୲౰͍ͯ͠ΔWebαʔϏεͰࠓ೔΋ݩؾʹಈ͍͍ͯ·͢
  3. Ͱ͖Ε͹TinyGoͰಈ͔͍ͨ͠ • Of fi cial Go : 6105.21 KiB /

    gzip: 1650.72 KiB • TinyGo: 2215.79 KiB / gzip: 769.47 KiB • Of fi cial Go Compiler൛ͩͱແྉ࿮Ͱ͸ΞοϓϩʔυͰ͖ͳ͍ • ※౰ํ՝͍ۚͯ͠·͢ɻ͓Ұਓ༷misskeyͷϑϩϯτʹஔ͍͍ͯΔ
  4. ͦͷଞࠔͬͨ͜ͱ • time.TimeΛͦͷ··insert͠Α͏ͱ͢Δͱࢮ͵ • தͰre fl ect͕࢖ΘΕ͍ͯΔͨΊʁ `panic: ValueOf: invalid

    value` • int64ʹม׵͍ͯ͠Δ • ϩʔΧϧϞʔυͩͱ`time.Now`͕ΊͪΌͪ͘Όڰ͍ͬͯΔ • ʆ2077-07-23 14:29:52.008999936 +0900 UTC+9 m=+3394243792.008999937ʆ
  5. ࣮͸ࠔ͍ͬͯΔ͜ͱ • Cloud fl are Workersʹdeploy͢ΔͱSELECT͕ࣦഊ͢Δ • `panic: syscall/js: Value.Call:

    property close is not a function, got unde fi ned` • ެࣜGoίϯύΠϥͰ΋ࣦഊ͢Δ • લ͸௨ͬͯͨΑ͏ͳ… • INSERT͸௨Δ • (syumai͞Μʹ૬ஊ͍ͨ͠…)