Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.deleteFrom, .into and .joins don't support schema, only table names #32

Open
Brayden opened this issue May 29, 2024 · 0 comments
Open
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Brayden
Copy link
Member

Brayden commented May 29, 2024

Describe the bug
When you use any of the following query builder operations in a chain they only take in a table name property, but no schema property. If a table is embedded in a schema there is no way for it to know where that table is located and how to fetch it.

  • deleteFrom(...)
  • innerJoin(...)
  • leftJoin(...)
  • rightJoin(...)
  • outerJoin(...)
  • into(...)

To Reproduce
See the current interface definition below. The selectFrom operator does allow for a schema, but other operations such as DELETE, INSERT, and UPDATE don't support that.

export interface OuterbaseType {
    queryBuilder: QueryBuilder
    selectFrom: (
        columnsArray: { schema?: string; table: string; columns: string[] }[]
    ) => OuterbaseType
    insert: (data: { [key: string]: any }) => OuterbaseType
    update: (data: { [key: string]: any }) => OuterbaseType
    deleteFrom: (table: string) => OuterbaseType
    where: (condition: any) => OuterbaseType
    limit: (limit: number) => OuterbaseType
    offset: (offset: number) => OuterbaseType
    orderBy: (column: string, direction?: 'ASC' | 'DESC') => OuterbaseType
    innerJoin: (
        table: string,
        condition: string,
        options?: any
    ) => OuterbaseType
    leftJoin: (table: string, condition: string, options?: any) => OuterbaseType
    rightJoin: (
        table: string,
        condition: string,
        options?: any
    ) => OuterbaseType
    outerJoin: (
        table: string,
        condition: string,
        options?: any
    ) => OuterbaseType
    into: (table: string) => OuterbaseType
    returning: (columns: string[]) => OuterbaseType
    asClass: (classType: any) => OuterbaseType
    query: () => Promise<any>
    queryRaw: (query: string, parameters?: QueryParams) => Promise<any>
    groupBy: (column: string) => OuterbaseType
    toString: () => string
}

Expected behavior
One may expect this to behave by passing both a schema and a table name into these and keeping them closely correlated when constructing queries.

Screenshots
N/A

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context
N/A

@Brayden Brayden added bug Something isn't working good first issue Good for newcomers labels May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant