type Server struct {}
type User struct{
ID string
}
func (s *Server) GetUser(id string) *User {}
type Client struct {}
func (c *Client)DoSomething() {
u := c.GetUser("userid")
}
8
Slide 9
Slide 9 text
REST
だったら
type Server struct {}
func main() {
r := gin.Default()
r.GET("/user/:id", getUser)
r.Run()
}
func getUser(c *gin.Context) {}
type Client struct {}
func (c *Client) DoSomething() {
resp, err := http.Get("http://user/1")
}
9