Skip to content

formatMany is partial for no good reason #129

@Profpatsch

Description

@Profpatsch

We’ve had production issues because of:

formatMany :: (ToRow q) => Connection -> Query -> [q] -> IO ByteString
formatMany _ q [] = fmtError "no rows supplied" q []
formatMany conn q@(Query template) qs = do

I think the function signature should be changed to:

formatMany :: (ToRow q) => Connection -> Query -> NonEmpty q -> IO ByteString

The breaking change is pretty much worth it, because anybody using this function that does not put a check (trivial to get wrong) will have a sleeping bug that blows up at the worst times.

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