@@ -199,6 +199,98 @@ export function _neq(columnName, filterValue) {
199
199
return `${ columnName } =neq.${ filterValue } `
200
200
}
201
201
202
+ /**
203
+ * Finds all rows whose tsvector value on the stated columnName matches to_tsquery(queryText).
204
+ * @param {string } columnName Name of the database column
205
+ * @param { object } filterObject query text and optionally config to base the match on
206
+ * @name fts
207
+ * @function
208
+ * @returns {string }
209
+ *
210
+ * @example
211
+ * _fts('phrase', {queryText: 'The Fat Cats'})
212
+ * //=>
213
+ * 'phrase=fts.The Fat Cats'
214
+ *
215
+ * @example
216
+ * _fts('phrase', {queryText: 'The Fat Cats', config: 'english'})
217
+ * //=>
218
+ * 'phrase=fts(english).The Fat Cats'
219
+ */
220
+ export function _fts ( columnName , filterObject ) {
221
+ if ( typeof filterObject . config == 'undefined' ) return `${ columnName } =fts.${ filterObject . queryText } `
222
+ return `${ columnName } =fts(${ filterObject . config } ).${ filterObject . queryText } `
223
+ }
224
+
225
+ /**
226
+ * Finds all rows whose tsvector value on the stated columnName matches plainto_tsquery(queryText).
227
+ * @param {string } columnName Name of the database column
228
+ * @param { object } filterObject query text and optionally config to base the match on
229
+ * @name plfts
230
+ * @function
231
+ * @returns {string }
232
+ *
233
+ * @example
234
+ * _plfts('phrase', {queryText: 'The Fat Cats'})
235
+ * //=>
236
+ * 'phrase=plfts.The Fat Cats'
237
+ *
238
+ * @example
239
+ * _plfts('phrase', {queryText: 'The Fat Cats', config: 'english'})
240
+ * //=>
241
+ * 'phrase=plfts(english).The Fat Cats'
242
+ */
243
+ export function _plfts ( columnName , filterObject ) {
244
+ if ( typeof filterObject . config == 'undefined' ) return `${ columnName } =plfts.${ filterObject . queryText } `
245
+ return `${ columnName } =plfts(${ filterObject . config } ).${ filterObject . queryText } `
246
+ }
247
+
248
+ /**
249
+ * Finds all rows whose tsvector value on the stated columnName matches phraseto_tsquery(queryText).
250
+ * @param {string } columnName Name of the database column
251
+ * @param { object } filterObject query text and optionally config to base the match on
252
+ * @name phfts
253
+ * @function
254
+ * @returns {string }
255
+ *
256
+ * @example
257
+ * _phfts('phrase', {queryText: 'The Fat Cats'})
258
+ * //=>
259
+ * 'phrase=phfts.The Fat Cats'
260
+ *
261
+ * @example
262
+ * _phfts('phrase', {queryText: 'The Fat Cats', config: 'english'})
263
+ * //=>
264
+ * 'phrase=phfts(english).The Fat Cats'
265
+ */
266
+ export function _phfts ( columnName , filterObject ) {
267
+ if ( typeof filterObject . config == 'undefined' ) return `${ columnName } =phfts.${ filterObject . queryText } `
268
+ return `${ columnName } =phfts(${ filterObject . config } ).${ filterObject . queryText } `
269
+ }
270
+
271
+ /**
272
+ * Finds all rows whose tsvector value on the stated columnName matches websearch_to_tsquery(queryText).
273
+ * @param {string } columnName Name of the database column
274
+ * @param { object } filterObject query text and optionally config to base the match on
275
+ * @name wfts
276
+ * @function
277
+ * @returns {string }
278
+ *
279
+ * @example
280
+ * _wfts('phrase', {queryText: 'The Fat Cats'})
281
+ * //=>
282
+ * 'phrase=wfts.The Fat Cats'
283
+ *
284
+ * @example
285
+ * _wfts('phrase', {queryText: 'The Fat Cats', config: 'english'})
286
+ * //=>
287
+ * 'phrase=wfts(english).The Fat Cats'
288
+ */
289
+ export function _wfts ( columnName , filterObject ) {
290
+ if ( typeof filterObject . config == 'undefined' ) return `${ columnName } =wfts.${ filterObject . queryText } `
291
+ return `${ columnName } =wfts(${ filterObject . config } ).${ filterObject . queryText } `
292
+ }
293
+
202
294
/**
203
295
* Finds all rows whose json || array || range value on the stated columnName contains the values specified in the filterObject.
204
296
* @param {string } columnName Name of the database column
0 commit comments