Skip to content

look into sqlx #26

Open
Open
@jrheard

Description

@jrheard

figuring out how to do simple stuff in diesel is giving me a lot of trouble. here's my first attempt at splitting out a portion of a WHERE clause so that it can be reused:

pub fn alive_tasks<'a>() -> Box<dyn BoxableExpression<task::table, Pg, SqlType = Bool> + 'a> {
    Box::new(task::mode.eq(any(vec![MODE_PENDING.0, MODE_ACTIVE.0])))
}

absolutely hideous.

also, afaict i can't do this:

    let query = task::table.find(task_id);
    if !include_deleted {
        query = query.filter(task::mode.ne(MODE_DELETED.0));
    }

because the second query value has a different type from the first.

hopefully i'm just doing stuff wrong and diesel is actually great! but comradeblue in irc uses https://github.com/launchbadge/sqlx , so i should do some research on that someday. low-priority.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions