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

Go/GAEで作る金融システム / Finance system made with Go and GAE

Go/GAEで作る金融システム / Finance system made with Go and GAE

Next Currency Inc.

October 11, 2018
Tweet

Other Decks in Technology

Transcript

  1. Agenda • ձࣾʹ͍ͭͯ • 4ͭͷʮ͍͍ͧʯ - Google App Engine(GAE)͸͍͍ͧ -

    Stackdriver Logging͸͍͍ͧ - Protocol Buffers͸͍͍ͧ - Golang͸͍͍ͧ
  2. ࢖༻ٕज़ • Google Cloud Platform - Google App Engine -

    Cloud SQL - Datastore - Cloud Functions • Golang - ϝΠϯͱͳΔϩδοΫ • Node.js - Cloud FunctionsͰͷϩάૢ࡞
  3. ࢖༻ٕज़ • Google Cloud Platform - Google App Engine -

    Cloud SQL - Datastore - Cloud Functions • Golang - ϝΠϯͱͳΔϩδοΫ • Node.js - Cloud FunctionsͰͷϩάૢ࡞
  4. ࢖༻ٕज़ • Google Cloud Platform - Google App Engine -

    Cloud SQL - Datastore - Cloud Functions • Golang - ϝΠϯͱͳΔϩδοΫ • Node.js - Cloud FunctionsͰͷϩάૢ࡞ &BTZ
  5. ࢖༻ٕज़ • Google Cloud Platform - Google App Engine -

    Cloud SQL - Datastore - Cloud Functions • Golang - ϝΠϯͱͳΔϩδοΫ • Node.js - Cloud FunctionsͰͷϩάૢ࡞
  6. ࢖༻ٕज़ • Google Cloud Platform - Google App Engine -

    Cloud SQL - Datastore - Cloud Functions • Golang - ϝΠϯͱͳΔϩδοΫ • Node.js - Cloud FunctionsͰͷϩάૢ࡞ 4JNQMF
  7. ָ

  8. syntax = "proto3"; package echo; option go_package = "pb"; option

    java_package = ""; option swift_prefix = ""; message EchoRequest { string msg = 1; } message EchoResponse { string echo_msg = 1; } service EchoService { rpc Echo(EchoRequest) returns (EchoResponse) {} } echo.proto
  9. syntax = "proto3"; package echo; option go_package = "pb"; option

    java_package = ""; option swift_prefix = ""; message EchoRequest { string msg = 1; } message EchoResponse { string echo_msg = 1; } service EchoService { rpc Echo(EchoRequest) returns (EchoResponse) {} } echo.proto
  10. syntax = "proto3"; package echo; option go_package = "pb"; option

    java_package = ""; option swift_prefix = ""; message EchoRequest { string msg = 1; } message EchoResponse { string echo_msg = 1; } service EchoService { rpc Echo(EchoRequest) returns (EchoResponse) {} } echo.proto
  11. syntax = "proto3"; package echo; option go_package = "pb"; option

    java_package = ""; option swift_prefix = ""; message EchoRequest { string msg = 1; } message EchoResponse { string echo_msg = 1; } service EchoService { rpc Echo(EchoRequest) returns (EchoResponse) {} } echo.proto
  12. syntax = "proto3"; package echo; option go_package = "pb"; option

    java_package = ""; option swift_prefix = ""; message EchoRequest { string msg = 1; } message EchoResponse { string echo_msg = 1; } service EchoService { rpc Echo(EchoRequest) returns (EchoResponse) {} } echo.proto
  13. type EchoRequest struct { Msg string `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"` XXX_NoUnkeyedLiteral struct{}

    `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } type EchoServiceServer interface { Echo(context.Context, *EchoRequest) (*EchoResponse, error) } echo.pb.go
  14. type EchoRequest struct { Msg string `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"` XXX_NoUnkeyedLiteral struct{}

    `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } type EchoServiceServer interface { Echo(context.Context, *EchoRequest) (*EchoResponse, error) } echo.pb.go
  15. type EchoRequest struct { Msg string `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"` XXX_NoUnkeyedLiteral struct{}

    `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } type EchoServiceServer interface { Echo(context.Context, *EchoRequest) (*EchoResponse, error) } echo.pb.go
  16. type EchoRequest struct { Msg string `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"` XXX_NoUnkeyedLiteral struct{}

    `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } type EchoServiceServer interface { Echo(context.Context, *EchoRequest) (*EchoResponse, error) } echo.pb.go
  17. public final class Echo { private Echo() {} public static

    final class EchoRequest extends com.google.protobuf.GeneratedMessageV3 implements { // @@protoc_insertion_point(message_implements:echo.EchoRequest) private EchoRequest() { msg_ = ""; } public static final int MSG_FIELD_NUMBER = 1; private volatile java.lang.Object msg_; public java.lang.String getMsg() { } } } Echo.java
  18. public final class Echo { private Echo() {} public static

    final class EchoRequest extends com.google.protobuf.GeneratedMessageV3 implements { // @@protoc_insertion_point(message_implements:echo.EchoRequest) private EchoRequest() { msg_ = ""; } public static final int MSG_FIELD_NUMBER = 1; private volatile java.lang.Object msg_; public java.lang.String getMsg() { } } } Echo.java
  19. public final class Echo { private Echo() {} public static

    final class EchoRequest extends com.google.protobuf.GeneratedMessageV3 implements { // @@protoc_insertion_point(message_implements:echo.EchoRequest) private EchoRequest() { msg_ = ""; } public static final int MSG_FIELD_NUMBER = 1; private volatile java.lang.Object msg_; public java.lang.String getMsg() { } } } Echo.java
  20. Protocol Buffers • ه๏͕Θ͔Γ΍͍͢ • σʔλͷදݱํ๏͕๛͔ - int, double, repeated(Array),

    Map… • ֤ݴޠͷίʔυͦͷ΋ͷΛੜ੒ͯ͠࢖͏ - มߋ͕͋ͬͨ৔߹Ϗϧυ࣌ʹؾ͚ͮΔ
  21. syntax = "proto3"; package echo; option go_package = "pb"; option

    java_package = ""; option swift_prefix = ""; message EchoRequest { string msg = 1; } message EchoResponse { string echo_msg = 1; } service EchoService { rpc Echo(EchoRequest) returns (EchoResponse) {} } echo.proto
  22. syntax = "proto3"; package echo; option go_package = "pb"; option

    java_package = ""; option swift_prefix = ""; message EchoRequest { string msg = 1; } message EchoResponse { string echo_msg = 1; } service EchoService { rpc Echo(EchoRequest) returns (EchoResponse) {} } echo.proto
  23. syntax = "proto3"; package echo; option go_package = "pb"; option

    java_package = ""; option swift_prefix = ""; message EchoRequest { string msg = 1; } message EchoResponse { string echo_msg = 1; } service EchoService { rpc Echo(EchoRequest) returns (EchoResponse) {} } echo.proto
  24. type EchoRequest struct { Msg string `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"` XXX_NoUnkeyedLiteral struct{}

    `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } type EchoServiceServer interface { Echo(context.Context, *EchoRequest) (*EchoResponse, error) } echo.pb.go
  25. type EchoRequest struct { Msg string `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"` XXX_NoUnkeyedLiteral struct{}

    `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } type EchoServiceServer interface { Echo(context.Context, *EchoRequest) (*EchoResponse, error) } echo.pb.go
  26. type EchoRequest struct { Msg string `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"` XXX_NoUnkeyedLiteral struct{}

    `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } type EchoServiceServer interface { Echo(context.Context, *EchoRequest) (*EchoResponse, error) } echo.pb.go
  27. func f(li []int) []int { ret := make([]int, 0) for

    _, n := range li { if n%2 == 0 { ret = append(ret, n) } } for i := range ret { ret[i] = ret[i] * 2 } return ret } Golang li.filter(n => n % 2 === 0) .map(n => n * 2) Javascript
  28. func f(li []int) []int { ret := make([]int, 0) for

    _, n := range li { if n%2 == 0 { ret = append(ret, n) } } for i := range ret { ret[i] = ret[i] * 2 } return ret } Golang li.filter(n => n % 2 === 0) .map(n => n * 2) Javascript ಡΈ΍͍͢ͷ͸Ͳͬͪʁ
  29. func f(li []int) []int { ret := make([]int, 0) for

    _, n := range li { if n%2 == 0 { ret = append(ret, n) } } for i := range ret { ret[i] = ret[i] * 2 } return ret } Golang li.filter(n => n % 2 === 0) .map(n => n * 2) Javascript ੜ࢈ੑ͕ߴ͍ͷ͸ʁ
  30. func f(li []int) []int { ret := make([]int, 0) for

    _, n := range li { if n%2 == 0 { ret = append(ret, n) } } for i := range ret { ret[i] = ret[i] * 2 } return ret } Golang li.filter(n => n % 2 === 0) .map(n => n * 2) Javascript ࣮ߦͷޮ཰͕͍͍ͷ͸ʁ
  31. func f(li []int) []int { ret := make([]int, 0) for

    _, n := range li { if n%2 == 0 { ret = append(ret, n) } } for i := range ret { ret[i] = ret[i] * 2 } return ret } Golang li.filter(n => n % 2 === 0) .map(n => n * 2) Javascript ίϯύΠϥ͕ղऍ͠΍͍͢ͷ͸ʁ
  32. func f(li []int) []int { ret := make([]int, 0) for

    _, n := range li { if n%2 == 0 { ret = append(ret, n) } } for i := range ret { ret[i] = ret[i] * 2 } return ret } Golang li.filter(n => n % 2 === 0) .map(n => n * 2) Javascript
  33. func f(li []int) []int { ret := make([]int, 0) for

    _, n := range li { if n%2 == 0 { ret = append(ret, n) } } for i := range ret { ret[i] = ret[i] * 2 } return ret } Golang li.filter(n => n % 2 === 0) .map(n => n * 2) Javascript ͲͪΒ΋ҙਤ͕ͳ͍
  34. func f(li []int) []int { ret := make([]int, 0) for

    _, n := range li { if n%2 == 0 { ret = append(ret, n) } } for i := range ret { ret[i] = ret[i] * 2 } return ret } Golang li.filter(n => n % 2 === 0) .map(n => n * 2) Javascript ͲͬͪͰ΋͍͍
  35. Javascript • ഑ྻͷཁૉΛಛఆͷ৚݅ͰߜΓ͍ͨʂ - filter͕͋ΔΑʂ • ഑ྻͷཁૉશͯΛૢ࡞Λ͍ͨ͠ʂ - map͕͋ΔΑʂ •

    ഑ྻͷཁૉ͢΂ͯΛ࢖ͬͯ݁ՌΛ࡞Γ͍ͨʂ - reduce͕͋ΔΑʂ Ͱ΋શ෦GPSϧʔϓͰ΋࣮ݱͰ͖ΔΑʂ