Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to set the function return fields #1

Open
diomalta opened this issue Feb 4, 2021 · 0 comments
Open

Possibility to set the function return fields #1

diomalta opened this issue Feb 4, 2021 · 0 comments

Comments

@diomalta
Copy link

diomalta commented Feb 4, 2021

Need to return specific fields in a search function and we were unable to use a .map or build a query.

Search functions only have a filter option. The idea was to use this field to be more robust so that it starts to receive more parameters.

Today

async findBy(condition: Filter<T> | ((qb: Knex.QueryBuilder<T>) => unknown)) {
    return this.select().where(condition) as Promise<T[]>;
}

To

async findBy(option: Filter<T> | ((qb: Knex.QueryBuilder<T>) => unknown)) {
    return this.select(option.select).where(option.where) as Promise<T[]>;
  }

If there are parameter implementations it could help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant