Skip to content

Bs-knex orderBy #3

@thangngoc89

Description

@thangngoc89

Right now, the current signature of orderBy is like this:

orderBy: 'a => queryBuilder

It's translated to knex like this:

knex
.orderBy("columnName")

But what about this usage:

knex
.orderBy("columnName", "DESC")

A common pattern for binding I saw it add a new function like:

orderByWithDirection: (string, string) => queryBuilder

And since there is only too possible direction (ASC and DESC), we can use bucklescript's unwrap feature to make it typesafe with polymorphic variants

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