课程: Practice It: Go REST API Server
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Check it: Create the order handler
(electronic music) - [Instructor] Now that you've tried it, let's walk through my solution. I've already pre-created the order.go file, also in the backend directory, and I added the package backend, I've imported, oh, I forgot to import the database, and I've already created the two structs, the order and the orderItem. But as you can see, we're missing the connection between order and orderItem. So how would we do that? Well, we know that we're going to have in the orderItem table, and OrderID and the ProductID, so we'll be able to match them up that way, but we'll need to save them into the order object somehow, so we'll add Items, and it'll be an array of orderItem, and then we'll add json naming for it, should be items. Just going to format this a little bit. Okay, now that we have that, let's talk about, let's add actually instead of talking, let's add in the requests handlers that…