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

Added onConflict to ModifyingQuery interface in types.d.ts #378

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,25 @@ declare module "sql" {
notExists(subQuery:SubQuery<any>):BinaryNode
}

interface OnConflictOptionsBase {
update?: string[]
}

interface OnConflictOptionsWithConstraint extends OnConflictOptionsBase {
constraint: string
columns?: undefined
}

interface OnConflictOptionsWithColumns extends OnConflictOptionsBase {
columns: string[]
constraint?: undefined
}

type OnConflictOptions = OnConflictOptionsWithConstraint | OnConflictOptionsWithColumns | (OnConflictOptionsWithConstraint & OnConflictOptionsWithColumns)

interface ModifyingQuery extends Executable {
returning<U>(...nodes:any[]):Query<U>
onConflict(options: OnConflictOptions): ModifyingQuery
where(...nodes:any[]):ModifyingQuery
}

Expand Down