n8n-nodes-base
Version:
Base nodes of n8n
189 lines (183 loc) • 7.41 kB
text/typescript
/**
* Postgres Node - Version 2.6
* Get, add and update data in Postgres
*/
export interface PostgresV26Params {
resource?: unknown;
/**
* Operation
* @displayOptions.show { resource: ["database"] }
* @default insert
*/
operation?: 'deleteTable' | 'executeQuery' | 'insert' | 'upsert' | 'select' | 'update';
/**
* The schema that contains the table you want to work on
* @displayOptions.hide { operation: ["executeQuery"] }
* @default {"mode":"list","value":"public"}
*/
schema?: { __rl: true; mode: 'list' | 'name'; value: string; cachedResultName?: string };
/**
* The table you want to work on
* @displayOptions.hide { operation: ["executeQuery"] }
* @default {"mode":"list","value":""}
*/
table?: { __rl: true; mode: 'list' | 'name'; value: string; cachedResultName?: string };
/**
* Command
* @displayOptions.show { resource: ["database"], operation: ["deleteTable"] }
* @displayOptions.hide { table: [""] }
* @default truncate
*/
deleteCommand?: 'truncate' | 'delete' | 'drop' | Expression<string>;
/**
* Whether to reset identity (auto-increment) columns to their initial values
* @displayOptions.show { deleteCommand: ["truncate"], resource: ["database"], operation: ["deleteTable"] }
* @displayOptions.hide { table: [""] }
* @default false
*/
restartSequences?: boolean | Expression<boolean>;
/**
* If not set, all rows will be selected
* @displayOptions.show { deleteCommand: ["delete"], resource: ["database"], operation: ["deleteTable", "select"] }
* @displayOptions.hide { table: [""] }
* @default {}
*/
where?: {
/** Values
*/
values?: Array<{
/** Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/" target="_blank">expression</a>
*/
column?: string | Expression<string>;
/** The operator to check the column against. When using 'LIKE' operator percent sign ( %) matches zero or more characters, underscore ( _ ) matches any single character.
* @default equal
*/
condition?: 'equal' | '!=' | 'LIKE' | '>' | '<' | '>=' | '<=' | 'IS NULL' | 'IS NOT NULL' | Expression<string>;
/** Value
* @displayOptions.hide { condition: ["IS NULL", "IS NOT NULL"] }
*/
value?: string | Expression<string> | PlaceholderValue;
}>;
};
/**
* How to combine the conditions defined in "Select Rows": AND requires all conditions to be true, OR requires at least one condition to be true
* @displayOptions.show { deleteCommand: ["delete"], resource: ["database"], operation: ["deleteTable", "select"] }
* @displayOptions.hide { table: [""] }
* @default AND
*/
combineConditions?: 'AND' | 'OR' | Expression<string>;
/**
* Options
* @displayOptions.show { resource: ["database"], operation: ["deleteTable", "executeQuery", "insert", "select", "update", "upsert"] }
* @displayOptions.hide { table: [""] }
* @default {}
*/
options?: {
/** Whether to drop all objects that depend on the table, such as views and sequences
* @displayOptions.show { /operation: ["deleteTable"] }
* @displayOptions.hide { /deleteCommand: ["delete"] }
* @default false
*/
cascade?: boolean | Expression<boolean>;
/** Number of seconds reserved for connecting to the database
* @default 30
*/
connectionTimeout?: number | Expression<number>;
/** Number of seconds to wait before idle connection would be eligible for closing
* @default 0
*/
delayClosingIdleConnection?: number | Expression<number>;
/** The way queries should be sent to the database
* @default single
*/
queryBatching?: 'single' | 'independently' | 'transaction';
/** Comma-separated list of the values you want to use as query parameters. <a href="https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.postgres/#use-query-parameters" target="_blank">More info</a>.
* @hint Comma-separated list of values: reference them in your query as $1, $2, $3…
* @displayOptions.show { /operation: ["executeQuery"] }
*/
queryReplacement?: string | Expression<string> | PlaceholderValue;
/** Whether to treat query parameters enclosed in single quotes as text e.g. '$1'
* @displayOptions.show { queryReplacement: [{"_cnd":{"exists":true}}] }
* @default false
*/
treatQueryParametersInSingleQuotesAsText?: boolean | Expression<boolean>;
/** Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/" target="_blank">expression</a>
* @displayOptions.show { /operation: ["select", "insert", "update", "upsert"] }
* @default []
*/
outputColumns?: string[];
/** Output Large-Format Numbers As
* @hint Applies to NUMERIC and BIGINT columns only
* @default text
*/
largeNumbersOutput?: 'numbers' | 'text' | Expression<string>;
/** Whether to skip the row and do not throw error if a unique constraint or exclusion constraint is violated
* @displayOptions.show { /operation: ["insert"] }
* @default false
*/
skipOnConflict?: boolean | Expression<boolean>;
/** Whether to replace empty strings with NULL in input, could be useful when data come from spreadsheet
* @displayOptions.show { /operation: ["insert", "update", "upsert", "executeQuery"] }
* @default false
*/
replaceEmptyStrings?: boolean | Expression<boolean>;
};
/**
* The SQL query to execute. You can use n8n expressions and $1, $2, $3, etc to refer to the 'Query Parameters' set in options below.
* @hint Consider using query parameters to prevent SQL injection attacks. Add them in the options below
* @displayOptions.show { resource: ["database"], operation: ["executeQuery"] }
*/
query?: string;
/**
* Columns
* @displayOptions.show { resource: ["database"], operation: ["insert", "update", "upsert"] }
* @displayOptions.hide { table: [""] }
* @default {"mappingMode":"defineBelow","value":null}
*/
columns?: string;
/**
* Whether to return all results or only up to a given limit
* @displayOptions.show { resource: ["database"], operation: ["select"] }
* @displayOptions.hide { table: [""] }
* @default false
*/
returnAll?: boolean | Expression<boolean>;
/**
* Max number of results to return
* @displayOptions.show { returnAll: [false], resource: ["database"], operation: ["select"] }
* @displayOptions.hide { table: [""] }
* @default 50
*/
limit?: number | Expression<number>;
/**
* Sort
* @displayOptions.show { resource: ["database"], operation: ["select"] }
* @displayOptions.hide { table: [""] }
* @default {}
*/
sort?: {
/** Values
*/
values?: Array<{
/** Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/" target="_blank">expression</a>
*/
column?: string | Expression<string>;
/** Direction
* @default ASC
*/
direction?: 'ASC' | 'DESC' | Expression<string>;
}>;
};
}
export interface PostgresV26Credentials {
postgres: CredentialReference;
}
interface PostgresV26NodeBase {
type: 'n8n-nodes-base.postgres';
version: 2.6;
credentials?: PostgresV26Credentials;
}
export type PostgresV26ParamsNode = PostgresV26NodeBase & {
config: NodeConfig<PostgresV26Params>;
};
export type PostgresV26Node = PostgresV26ParamsNode;