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

Gomaについて

 Gomaについて

ORマッパーとは一味ちがう!

kyokomi

April 13, 2015
Tweet

More Decks by kyokomi

Other Decks in Programming

Transcript

  1. ࣗݾ঺հ • Twi%er:)@k_yokomi)ʢ͖ΐ͜Έʣ※1 • GunosyͷAPIνʔϜͰGoΤϯδχΞ΍ ͬͯ·͢ • Cocos2d<xͰήʔϜ࡞ͬͨΓ΋ͯ͠·͢ • Gunosy.goͷओ࠵ͱ͔΍ͬͯ·͢

    • ΤλʔͳΒͳ͍։ൃΛ໨ࢦͯ͠·͢ ※1"ΞΠίϯ͸݄ඣͷᘡᘚ͞ΜͰ͢ɻ @k_yokomi,)2015/04/13)ʮGunosy.go#12)GolangNotH=pNightʯ 2
  2. ໨࣍ • Gomaʢމຑʣʹ͍ͭͯ • ֓ཁʢ༻ҙɺग़ྗ෺ɺ࢖͍ํʣ • ಛ௃ʢଞͱͷҧ͍ͱ͔ʣ • ࣮૷ͷߏ੒ •

    σϞ • ࠓޙʹ͍ͭͯ @k_yokomi,)2015/04/13)ʮGunosy.go#12)GolangNotH=pNightʯ 3
  3. Gomaʢމຑʣʹඞཁͳ΋ͷ • ίʔυੜ੒ݩͱͳΔDBςʔϒϧ • DB΁ͷ઀ଓ৘ใ • config.json$or$ίϚϯυҾ਺Մ • gomaͷΠϯετʔϧ •

    go get gopkg.in/kyokomi/ goma.v1/gen/goma • ※ৄࡉ͸GitHubͷREADME.md΁ @k_yokomi,)2015/04/13)ʮGunosy.go#12)GolangNotH=pNightʯ 6
  4. config.json config.jsonΛ༻ҙ͠·͢ɻTOMLͱ͔yamlͱ͔ͷαϙʔτ΋શવՄ ೳͰ͢ɻ PullReqeust͓଴ͪͯ͠·͢ɻ { "driver": "mysql", "user": "admin", "password":

    "password", "host": "localhost", "port": 3306, "db": "test" } @k_yokomi,)2015/04/13)ʮGunosy.go#12)GolangNotH=pNightʯ 8
  5. go#generateͰ΋OK package main import ( "fmt" ) //go:generate goma gen-config

    --path config.json func main() { fmt.Println("Hello goma!") } @k_yokomi,)2015/04/13)ʮGunosy.go#12)GolangNotH=pNightʯ 10
  6. go#bindataʹରԠͯ͠ΔͷͰ҆৺ ͜Μͳײ͡ʹ࣮ߦ͢Δͱ͍͍ײ͡Ͱ͢ɻ $ go-bindata -o dao/asset_gen.go -pkg dao sql/... ※2

    ※2"go%bindata:"ࢦఆσΟϨΫτϦ΍ϑΝΠϧΛόΠφϦσʔλͱͯ࣋ͭ͠GoͷίʔυΛgenerate͢ΔϥΠϒϥϦ @k_yokomi,)2015/04/13)ʮGunosy.go#12)GolangNotH=pNightʯ 18