Skip to content

Make better use of Multi.run #237

@jinjagit

Description

@jinjagit

Use Multi.run to compose sequential db operations.

For example, we perform 3 different get_by db queries in get_delegation!/5, in lib/liquid_voting/delegations.ex, before a final get_by to find the delegation.

Multi.run could be used here, and any for other similarly sequential db operations. It has many advantages, one of which being that it "saves multiple round trips to the database".

For an example of Multi.run, see create_delegation/1 (the clause that uses emails), also in lib/liquid_voting/delegations.ex.

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