Rust-diesel transaction example for saving master-detail record


#1

Hi, I tried googling around but couldn’t find good example of rust-diesel implementation of transaction manager. Basically I want to save my the master-detail in single diesel transaction so if fail one fail all. I’m using postgres.

My master/detail is like;

{
    "transactionheader_id": 1,
    "transaction_lines": [
        {
            "transaction_line_id": 1
            "amount": 100,
        },
        {
            "transaction_line_id": 2
            "amount": 100,
        }  
    ]
}