Перейти к содержимому

Ep3 Golang Microservice Query Multiple Tables with One-To-Many in a Database Transaction with sqlx

david hwang

0:00 / 0:00

Ep3 Golang Microservice Query Multiple Tables with One-To-Many in a Database Transaction with sqlx

2 845 просмотров · 2 г. назад
david hwang
5,05 тыс. подписчиков
2 845 просмотров · 2 г. назад
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