Skip to content

Possibility to set the function return fields #1

@diomalta

Description

@diomalta

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.

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