import type { DbAdapter } from "../adapter.ts"; import type { PgType } from "../pgtype.ts"; import type { Canonical } from "../canonicalise/index.ts"; declare const parameterModeMap: { readonly i: "IN"; readonly o: "OUT"; readonly b: "INOUT"; readonly v: "VARIADIC"; readonly t: "TABLE"; }; type ParameterMode = (typeof parameterModeMap)[keyof typeof parameterModeMap]; export type FunctionParameter = { name: string; type: Canonical; mode: ParameterMode; hasDefault: boolean; ordinalPosition: number; }; declare const volatilityMap: { readonly i: "IMMUTABLE"; readonly s: "STABLE"; readonly v: "VOLATILE"; }; type FunctionVolatility = (typeof volatilityMap)[keyof typeof volatilityMap]; declare const parallelSafetyMap: { readonly s: "SAFE"; readonly r: "RESTRICTED"; readonly u: "UNSAFE"; }; type FunctionParallelSafety = (typeof parallelSafetyMap)[keyof typeof parallelSafetyMap]; export declare enum FunctionReturnTypeKind { Regular = "regular", InlineTable = "inline_table", ExistingTable = "table" } export declare namespace FunctionReturnType { type Regular = { kind: FunctionReturnTypeKind.Regular; type: Canonical; isSet: boolean; }; type InlineTable = { kind: FunctionReturnTypeKind.InlineTable; columns: { name: string; type: Canonical; }[]; isSet: boolean; }; type ExistingTable = { kind: FunctionReturnTypeKind.ExistingTable; schema: string; name: string; isSet: boolean; }; } export type FunctionReturnType = FunctionReturnType.Regular | FunctionReturnType.InlineTable | FunctionReturnType.ExistingTable; export interface FunctionDetails extends PgType<"function"> { parameters: FunctionParameter[]; returnType: FunctionReturnType; language: string; definition: string; isStrict: boolean; isSecurityDefiner: boolean; isLeakProof: boolean; volatility: FunctionVolatility; parallelSafety: FunctionParallelSafety; estimatedCost: number; estimatedRows: number | null; comment: string | null; } declare function extractFunction(db: DbAdapter, pgType: PgType<"function">): Promise; export default extractFunction;