FindBy
Receives any parameter as an argument as long as it is a { key: value } or array of { key: value }.
const example = await this.examplesRepository.findBy(
{ where: { id: 123 } },
trx,
);
// Find one where id = 123const example = await this.examplesRepository.findBy(
{ where: { id: 123, name: "example" } },
trx,
);
// Find one where id = 123 AND name = "example"const example = await this.examplesRepository.findBy(
{
where: [
{ id: 123 },
{ name: "example" },
],
},
trx,
);
/** Find one where id = 123 OR name = "example"
* You also can use a mapper to make your work easier and cleaner
* There will be an introduction about them right under the standard queries introduction
*/