Skip to content

What is the best method that "bulk insert" and "where in" ? #312

Closed
@dyoshikawa

Description

@dyoshikawa

I want to bulk insert with sqlx.

-- bulk insert example
INSERT INTO people(name)
VALUES('foo'), ('bar'), ('baz')

I also want to "where in" with this.

-- where in example
SELECT * FROM people WHERE name IN ('foo', 'bar', 'baz')

I wrote the code and created the repository:
https://github.com/dyoshikawa/sqlx-bulk-insert-and-where-in-query-example/blob/fcc50716f4ed8d48924de996863aa6916f89af8d/src/main.rs#L19-L59

Do you have the idea better than this?
Thanks for reading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions