-
Notifications
You must be signed in to change notification settings - Fork 167
/
policiesTypes.ts
43 lines (32 loc) · 976 Bytes
/
policiesTypes.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
import type { IfExistsOption, Name } from './generalTypes';
export interface PolicyOptions {
role?: string | string[];
using?: string;
check?: string;
}
interface CreatePolicyOptionsEn {
command?: 'ALL' | 'SELECT' | 'INSERT' | 'UPDATE' | 'DELETE';
}
export type CreatePolicyOptions = CreatePolicyOptionsEn & PolicyOptions;
type CreatePolicyFn = (
tableName: Name,
policyName: string,
options?: CreatePolicyOptions & IfExistsOption
) => string | string[];
export type CreatePolicy = CreatePolicyFn & { reverse: CreatePolicyFn };
export type DropPolicy = (
tableName: Name,
policyName: string,
options?: IfExistsOption
) => string | string[];
export type AlterPolicy = (
tableName: Name,
policyName: string,
options: PolicyOptions
) => string | string[];
type RenamePolicyFn = (
tableName: Name,
policyName: string,
newPolicyName: string
) => string | string[];
export type RenamePolicy = RenamePolicyFn & { reverse: RenamePolicyFn };