OR & AND
Both OR and AND can be used to query custom data:
Using OR & AND:
const search: Search = {
where: [
AND(
{
field: "storeId",
operation: OperationTypes.EQUAL,
value: 1,
},
OR(
AND(
{
field: "dateStart",
operation: OperationTypes.LESS_EQUAL,
value: '2025-01-01',
},
{
field: "dateEnd",
operation: OperationTypes.GREATER_EQUAL,
value: '2025-01-31',
}
),
AND(
{
field: "dateStart",
operation: OperationTypes.EQUAL,
value: null,
},
{
field: "dateEnd",
operation: OperationTypes.EQUAL,
value: null,
}
)
)
),
],
};is equivalent in TypeORM to (you have to use cartesian products because of TypeORM's documentation on OR & AND):
will execute following query:
Last updated