get table definition

This commit is contained in:
Julian Krauser 2024-11-27 15:01:31 +01:00
parent 717de68f4e
commit 9944fb931a
2 changed files with 40 additions and 5 deletions

View file

@ -2,7 +2,7 @@ export interface DynamicQueryStructure {
select: string[] | "*";
table: string;
where?: Partial<ConditionStructure>;
join?: Array<DynamicQueryStructure>;
join?: Array<DynamicQueryStructure & { foreignColumn: string }>;
orderBy?: { [key: string]: "ASC" | "DESC" };
}
@ -40,17 +40,18 @@ const exampleQuery: DynamicQueryStructure = {
table: "member",
where: {
AND: {
mail: { eq: 1 },
mail: { endsWith: "@gmail.com" },
OR: {
firstname: { eq: "hi" },
lastname: { eq: "ho" },
firstname: { startsWith: "J" },
lastname: { endsWith: "K" },
},
},
},
join: [
{
select: "*",
table: "adress",
table: "communication",
foreignColumn: "sendNewsletter",
},
],
orderBy: {