Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change transaction apply_batch to take argument by-reference. #1015

Merged
merged 1 commit into from
Mar 13, 2020

Commits on Mar 12, 2020

  1. Change apply_batch to take argument by-reference.

    This change facilitates that you can setup a batch and then execute it
    inside of a transaction. For example:
    
    ```rust
    let db = config.open().unwrap();
    let t1 = db.open_tree(b"1")?;
    
    let mut b1 = Batch::default();
    b1.insert(b"k1", b"v1");
    b1.insert(b"k2", b"v2");
    
    t1.transaction(|tree| {
        tree.apply_batch(&b1)?;
        Ok(())
    })?;
    ```
    
    Signed-off-by: Valdemar Erk <[email protected]>
    Erk- committed Mar 12, 2020
    Configuration menu
    Copy the full SHA
    5e57f48 View commit details
    Browse the repository at this point in the history