-
Notifications
You must be signed in to change notification settings - Fork 180
/
Copy pathfunctionsTypes.ts
52 lines (35 loc) · 1.09 KB
/
functionsTypes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import type { DropOptions, Name, Value } from './generalTypes';
export interface FunctionParamType {
mode?: 'IN' | 'OUT' | 'INOUT' | 'VARIADIC';
name?: string;
type: string;
default?: Value;
}
export type FunctionParam = string | FunctionParamType;
export interface FunctionOptions {
returns?: string;
language: string;
replace?: boolean;
window?: boolean;
behavior?: 'IMMUTABLE' | 'STABLE' | 'VOLATILE';
onNull?: boolean;
parallel?: 'UNSAFE' | 'RESTRICTED' | 'SAFE';
}
type CreateFunctionFn = (
functionName: Name,
functionParams: FunctionParam[],
functionOptions: FunctionOptions & DropOptions,
definition: Value
) => string | string[];
export type CreateFunction = CreateFunctionFn & { reverse: CreateFunctionFn };
export type DropFunction = (
functionName: Name,
functionParams: FunctionParam[],
dropOptions?: DropOptions
) => string | string[];
type RenameFunctionFn = (
oldFunctionName: Name,
functionParams: FunctionParam[],
newFunctionName: Name
) => string | string[];
export type RenameFunction = RenameFunctionFn & { reverse: RenameFunctionFn };