Skip to content

Query.first has unexpected behavior #110

@sixcircuit

Description

@sixcircuit
func get(index: Int) -> Row? {
    let query = db["some_table"].limit(1, offset: index);
    return(query.first);
}

get(0) // gets row 0
get(3) // gets row 0

That behavior seems unexpected, it took me a while to figure it out. The problem is that first reruns the query with limit(1) and discards the offset: var generator = limit(1).generate(). Thanks for a great library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions