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

JavaエンジニアからみたVapor

kissybnts
November 21, 2017

 JavaエンジニアからみたVapor

Swift/Kotlin合同勉強会 #2のLT資料です

kissybnts

November 21, 2017
Tweet

More Decks by kissybnts

Other Decks in Programming

Transcript

  1. Name: Kishida @KissyBnts Company: Monstar Lab, Inc. Role: Server side

    engineer, Bridge engineer Language: Java, Kotlin, TypeScript
  2. 

  3. $ vapor new <name> - -template=<template name> $ cd <name>

    $ vapor run template list https://github.com/search?utf8=%E2%9C%93&q=topic%3Avapor+topic%3Atemplate&type=Repositories
  4. w ؀ڥߏங͕؆୯ w Ұ௨Γͷػೳ͕ἧ͍ͬͯͯ௥Ճ͕؆୯ w υΩϡϝϯτ͕๛෋ͰεϚʔτ w ׂͱ 03.͕࢖͍΍͔ͬͨ͢ w

    ؀ڥߏங͕؆୯ w Ұ௨Γͷػೳ͕ἧ͍ͬͯͯ௥Ճ͕؆୯ w υΩϡϝϯτ͕๛෋ͰεϚʔτ w 7FSTJPOͰ݁ߏมΘΔΈ͍ͨ
  5. final class User : Model { var name: String var

    age: Int init(name: String, age: Int) { self.name = name self.age = age } init(row: Row) throws { name = try row.get(“name”) age = try row.get(“age”) } func makeRow() throws -> Row { var row = Row() try row.set(“name”, name) try row.set(“age”, age) return row } }
  6. let user = User(“Kishida”, 25) try user.save() try user.delete() try

    User.makeQuery() .filter(“age”, 20) .sort(“id”, .ascending) .all()