agrupadores26

This commit is contained in:
Luiz Silva 2026-02-17 11:18:39 -03:00
parent f2a223b015
commit 64ddd6ad8a
6 changed files with 30 additions and 14 deletions

View file

@ -112,6 +112,11 @@ export enum operadores26 {
in = "in",
}
export enum agrupadores26 {
E = "E",
OU = "OU",
}
type PgOpsNumber = {
[K in Extract<operadores26, "=" | "!=" | ">" | ">=" | "<" | "<=">]?: number
} & {
@ -213,18 +218,18 @@ type Pessoa = {
}
}
const _filtro: tipoFiltro26<Pessoa> = {
export const criarFiltro26 = <T>(filtro: tipoFiltro26<T>) => filtro
const _filtro = criarFiltro26<Pessoa>({
idade: { [operadores26[">="]]: 18 },
OU: [
[agrupadores26.OU]: [
{ nome: { [operadores26.like]: "%pa%" } },
{
E: [
[agrupadores26.E]: [
{ carro: { ano: { [operadores26["="]]: 2020 } } },
{ carro: { modelo: { [operadores26.in]: ["Civic", "Corolla"] } } },
],
},
],
}
export const criarFiltro26 = <T>(filtro: tipoFiltro26<T>) => filtro
})