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

Add support for batch queries #14

Merged
merged 1 commit into from
Nov 18, 2024
Merged

Add support for batch queries #14

merged 1 commit into from
Nov 18, 2024

Conversation

vponomaryov
Copy link
Collaborator

@vponomaryov vponomaryov commented Nov 4, 2024

Example of it's usage:

  pub async fn insert(db, i) {
    ...
    let stmt_keys = [];
    let stmt_values = [];
    ...
    stmt_keys.push(some_prepared_statement_name);
    stmt_values.push([
      user_id, user_name, permissions,
    ]);
    ...
    db.batch_prepared(stmt_keys, stmt_values).await?
    ...
  }

To reuse the same gathered values in non-batch call do following:

  pub async fn insert(db, i) {
    ...
    db.execute_prepared(stmt_keys[0], stmt_values[0]).await?
    ...
  }

Closes: #12

Example of it's usage:

  pub async fn insert(db, i) {
    ...
    let stmt_keys = [];
    let stmt_values = [];
    ...
    stmt_keys.push(some_prepared_statement_name);
    stmt_values.push([
      user_id, user_name, permissions,
    ]);
    ...
    db.batch_prepared(stmt_keys, stmt_values).await?
    ...
  }

To reuse the same gathered values in non-batch call do following:

  pub async fn insert(db, i) {
    ...
    db.execute_prepared(stmt_keys[0], stmt_values[0]).await?
    ...
  }

Closes: #12
@vponomaryov
Copy link
Collaborator Author

Copy link
Collaborator

@fruch fruch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vponomaryov vponomaryov merged commit 59e33f8 into main Nov 18, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add batch queries support
2 participants