@openfn/language-mysql 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ast.json +1 -2
- package/package.json +1 -1
- package/types/Adaptor.d.ts +6 -100
package/ast.json
CHANGED
|
@@ -19,9 +19,8 @@
|
|
|
19
19
|
"description": "upsertMany(\n 'users', // the DB table\n [\n { name: 'one', email: 'one@openfn.org' },\n { name: 'two', email: 'two@openfn.org' },\n ]\n)"
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
|
-
"title": "
|
|
22
|
+
"title": "function",
|
|
23
23
|
"description": null,
|
|
24
|
-
"type": null,
|
|
25
24
|
"name": null
|
|
26
25
|
},
|
|
27
26
|
{
|
package/package.json
CHANGED
package/types/Adaptor.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** @module Adaptor */
|
|
2
1
|
/**
|
|
3
2
|
* Execute a sequence of operations.
|
|
4
3
|
* Wraps `language-common/execute`, and prepends initial state for mysql.
|
|
@@ -7,27 +6,11 @@
|
|
|
7
6
|
* create('foo'),
|
|
8
7
|
* delete('bar')
|
|
9
8
|
* )(state)
|
|
10
|
-
* @
|
|
9
|
+
* @function
|
|
11
10
|
* @param {Operations} operations - Operations to be performed.
|
|
12
11
|
* @returns {Operation}
|
|
13
12
|
*/
|
|
14
13
|
export function execute(...operations: Operations): Operation;
|
|
15
|
-
export class execute {
|
|
16
|
-
/** @module Adaptor */
|
|
17
|
-
/**
|
|
18
|
-
* Execute a sequence of operations.
|
|
19
|
-
* Wraps `language-common/execute`, and prepends initial state for mysql.
|
|
20
|
-
* @example
|
|
21
|
-
* execute(
|
|
22
|
-
* create('foo'),
|
|
23
|
-
* delete('bar')
|
|
24
|
-
* )(state)
|
|
25
|
-
* @constructor
|
|
26
|
-
* @param {Operations} operations - Operations to be performed.
|
|
27
|
-
* @returns {Operation}
|
|
28
|
-
*/
|
|
29
|
-
constructor(...operations: Operations);
|
|
30
|
-
}
|
|
31
14
|
/**
|
|
32
15
|
* Insert a record
|
|
33
16
|
* @example
|
|
@@ -36,28 +19,12 @@ export class execute {
|
|
|
36
19
|
* field('name', dataValue('name'))
|
|
37
20
|
* ))
|
|
38
21
|
* )(state)
|
|
39
|
-
* @
|
|
22
|
+
* @function
|
|
40
23
|
* @param {string} table - The target table
|
|
41
24
|
* @param {object} fields - A fields object
|
|
42
25
|
* @returns {Operation}
|
|
43
26
|
*/
|
|
44
27
|
export function insert(table: string, fields: object): Operation;
|
|
45
|
-
export class insert {
|
|
46
|
-
/**
|
|
47
|
-
* Insert a record
|
|
48
|
-
* @example
|
|
49
|
-
* execute(
|
|
50
|
-
* insert('table', fields(
|
|
51
|
-
* field('name', dataValue('name'))
|
|
52
|
-
* ))
|
|
53
|
-
* )(state)
|
|
54
|
-
* @constructor
|
|
55
|
-
* @param {string} table - The target table
|
|
56
|
-
* @param {object} fields - A fields object
|
|
57
|
-
* @returns {Operation}
|
|
58
|
-
*/
|
|
59
|
-
constructor(table: string, fields: object);
|
|
60
|
-
}
|
|
61
28
|
/**
|
|
62
29
|
* Insert or Update a record if matched
|
|
63
30
|
* @example
|
|
@@ -66,28 +33,12 @@ export class insert {
|
|
|
66
33
|
* field('name', dataValue('name'))
|
|
67
34
|
* ))
|
|
68
35
|
* )(state)
|
|
69
|
-
* @
|
|
36
|
+
* @function
|
|
70
37
|
* @param {string} table - The target table
|
|
71
38
|
* @param {object} fields - A fields object
|
|
72
39
|
* @returns {Operation}
|
|
73
40
|
*/
|
|
74
41
|
export function upsert(table: string, fields: object): Operation;
|
|
75
|
-
export class upsert {
|
|
76
|
-
/**
|
|
77
|
-
* Insert or Update a record if matched
|
|
78
|
-
* @example
|
|
79
|
-
* execute(
|
|
80
|
-
* upsert('table', fields(
|
|
81
|
-
* field('name', dataValue('name'))
|
|
82
|
-
* ))
|
|
83
|
-
* )(state)
|
|
84
|
-
* @constructor
|
|
85
|
-
* @param {string} table - The target table
|
|
86
|
-
* @param {object} fields - A fields object
|
|
87
|
-
* @returns {Operation}
|
|
88
|
-
*/
|
|
89
|
-
constructor(table: string, fields: object);
|
|
90
|
-
}
|
|
91
42
|
/**
|
|
92
43
|
* Insert or update multiple records using ON DUPLICATE KEY
|
|
93
44
|
* @public
|
|
@@ -99,76 +50,31 @@ export class upsert {
|
|
|
99
50
|
* { name: 'two', email: 'two@openfn.org' },
|
|
100
51
|
* ]
|
|
101
52
|
* )
|
|
102
|
-
* @
|
|
53
|
+
* @function
|
|
103
54
|
* @param {string} table - The target table
|
|
104
55
|
* @param {array} data - An array of objects or a function that returns an array
|
|
105
56
|
* @returns {Operation}
|
|
106
57
|
*/
|
|
107
58
|
export function upsertMany(table: string, data: any[]): Operation;
|
|
108
|
-
export class upsertMany {
|
|
109
|
-
/**
|
|
110
|
-
* Insert or update multiple records using ON DUPLICATE KEY
|
|
111
|
-
* @public
|
|
112
|
-
* @example
|
|
113
|
-
* upsertMany(
|
|
114
|
-
* 'users', // the DB table
|
|
115
|
-
* [
|
|
116
|
-
* { name: 'one', email: 'one@openfn.org' },
|
|
117
|
-
* { name: 'two', email: 'two@openfn.org' },
|
|
118
|
-
* ]
|
|
119
|
-
* )
|
|
120
|
-
* @constructor
|
|
121
|
-
* @param {string} table - The target table
|
|
122
|
-
* @param {array} data - An array of objects or a function that returns an array
|
|
123
|
-
* @returns {Operation}
|
|
124
|
-
*/
|
|
125
|
-
constructor(table: string, data: any[]);
|
|
126
|
-
}
|
|
127
59
|
/**
|
|
128
60
|
* Execute a SQL statement
|
|
129
61
|
* @example
|
|
130
62
|
* execute(
|
|
131
63
|
* query({ sql: 'select * from users;' })
|
|
132
64
|
* )(state)
|
|
133
|
-
* @
|
|
65
|
+
* @function
|
|
134
66
|
* @param {object} options - Payload data for the message
|
|
135
67
|
* @returns {Operation}
|
|
136
68
|
*/
|
|
137
69
|
export function query(options: object): Operation;
|
|
138
|
-
export class query {
|
|
139
|
-
/**
|
|
140
|
-
* Execute a SQL statement
|
|
141
|
-
* @example
|
|
142
|
-
* execute(
|
|
143
|
-
* query({ sql: 'select * from users;' })
|
|
144
|
-
* )(state)
|
|
145
|
-
* @constructor
|
|
146
|
-
* @param {object} options - Payload data for the message
|
|
147
|
-
* @returns {Operation}
|
|
148
|
-
*/
|
|
149
|
-
constructor(options: object);
|
|
150
|
-
}
|
|
151
70
|
/**
|
|
152
71
|
* Execute a SQL statement
|
|
153
72
|
* @example
|
|
154
73
|
* execute(
|
|
155
74
|
* sqlString(state => "select * from items;")
|
|
156
75
|
* )(state)
|
|
157
|
-
* @
|
|
76
|
+
* @function
|
|
158
77
|
* @param {String} queryString - A query string (or function which takes state and returns a string)
|
|
159
78
|
* @returns {Operation}
|
|
160
79
|
*/
|
|
161
80
|
export function sqlString(queryString: string): Operation;
|
|
162
|
-
export class sqlString {
|
|
163
|
-
/**
|
|
164
|
-
* Execute a SQL statement
|
|
165
|
-
* @example
|
|
166
|
-
* execute(
|
|
167
|
-
* sqlString(state => "select * from items;")
|
|
168
|
-
* )(state)
|
|
169
|
-
* @constructor
|
|
170
|
-
* @param {String} queryString - A query string (or function which takes state and returns a string)
|
|
171
|
-
* @returns {Operation}
|
|
172
|
-
*/
|
|
173
|
-
constructor(queryString: string);
|
|
174
|
-
}
|