To query multiple tables with one-to-many relationships, we have to ensure that the queries are either committed on success or rolled back on failure altogether. That is where the database transaction comes into place to make our operations atomic.
github.com/dhij/ecomm
0:00 intro
1:08 intro to database transaction
1:44 define the structs
2:21 add the CreateOrder storer method
3:07 add the database transaction helper method
8:47 add the GetOrder/ListOrders/DeleteOrder storer methods
11:38 add and explain unit tests for TestCreateOrder, TestGetOrder, TestListOrders, and TestDeleteOrder
Watch video Ep3 Golang Microservice Query Multiple Tables with One-To-Many in a Database Transaction with sqlx online without registration, duration hours minute second in high quality. This video was added by user david hwang 01 July 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 742 once and liked it 33 people.