Skip to content

Commit

Permalink
Add common parameter names to ConnectionParameters TS type (#707)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkubliniak authored Oct 26, 2023
1 parent f2fb819 commit ca2754c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ const sql = postgres('postgres://username:password@host:port/database', {
},
connection : {
application_name : 'postgres.js', // Default application_name
... // Other connection parameters
... // Other connection parameters, see https://www.postgresql.org/docs/current/runtime-config-client.html
},
target_session_attrs : null, // Use 'read-write' with multiple hosts to
// ensure only connecting to primary
Expand Down
2 changes: 1 addition & 1 deletion deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ const sql = postgres('postgres://username:password@host:port/database', {
},
connection : {
application_name : 'postgres.js', // Default application_name
... // Other connection parameters
... // Other connection parameters, see https://www.postgresql.org/docs/current/runtime-config-client.html
},
target_session_attrs : null, // Use 'read-write' with multiple hosts to
// ensure only connecting to primary
Expand Down
12 changes: 11 additions & 1 deletion deno/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,18 @@ declare namespace postgres {
* @default 'postgres.js'
*/
application_name: string;
default_transaction_isolation: 'read uncommitted' | 'read committed' | 'repeatable read' | 'serializable',
default_transaction_read_only: boolean,
default_transaction_deferrable: boolean,
statement_timeout: number,
lock_timeout: number,
idle_in_transaction_session_timeout: number,
idle_session_timeout: number,
DateStyle: string,
IntervalStyle: string,
TimeZone: string,
/** Other connection parameters */
[name: string]: string;
[name: string]: string | number | boolean;
}

interface Options<T extends Record<string, postgres.PostgresType>> extends Partial<BaseOptions<T>> {
Expand Down
12 changes: 11 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,18 @@ declare namespace postgres {
* @default 'postgres.js'
*/
application_name: string;
default_transaction_isolation: 'read uncommitted' | 'read committed' | 'repeatable read' | 'serializable',
default_transaction_read_only: boolean,
default_transaction_deferrable: boolean,
statement_timeout: number,
lock_timeout: number,
idle_in_transaction_session_timeout: number,
idle_session_timeout: number,
DateStyle: string,
IntervalStyle: string,
TimeZone: string,
/** Other connection parameters */
[name: string]: string;
[name: string]: string | number | boolean;
}

interface Options<T extends Record<string, postgres.PostgresType>> extends Partial<BaseOptions<T>> {
Expand Down

0 comments on commit ca2754c

Please sign in to comment.