forked from oguimbal/pg-mem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstring.ts
32 lines (31 loc) · 925 Bytes
/
string.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
import { DataType, FunctionDefinition } from '../interfaces-private';
export const stringFunctions: FunctionDefinition[] = [
{
name: 'lower',
args: [DataType.text],
returns: DataType.text,
implementation: (x: string) => x?.toLowerCase(),
},
{
name: 'upper',
args: [DataType.text],
returns: DataType.text,
implementation: (x: string) => x?.toUpperCase(),
},
{
name: 'concat',
args: [DataType.text],
argsVariadic: DataType.text,
returns: DataType.text,
allowNullArguments: true,
implementation: (...x: string[]) => x?.join(''),
},
{
name: 'concat_ws',
args: [DataType.text],
argsVariadic: DataType.text,
returns: DataType.text,
allowNullArguments: true,
implementation: (separator: string, ...x: string[]) => x?.join(separator),
},
]