question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there any way I can use Knex.js for string pattern matching ?

See original GitHub issue

I would like to use knex.js to carry out a query similar to

"SELECT FROM table_name
WHERE column ILIKE 'XXXX%"

Do I have to use whereRaw for this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

27reactions
elhigucommented, Apr 13, 2017

.where('column', 'ilike', 'XXXX%') should do it.

12reactions
arthuranteatercommented, Mar 8, 2019

knex(‘users’).where(‘columnName’, ‘like’, ‘%rowlikeme%’) Outputs: select * from users where columnName like ‘%rowlikeme%’

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pattern matching with knex.js - Stack Overflow
What you need is to make a use of like operator with wild char % . The target query should look like: SELECT...
Read more >
Knex Query Builder
Knex Query Builder #. The heart of the library, the knex query builder is the interface used for building and executing standard SQL...
Read more >
Schema Builder | Knex.js
Creates a new table on the database, with a callback function to modify the table's structure, using the schema-building commands. knex.schema.
Read more >
Installation | Knex.js
Knex can be used as an SQL query builder in both Node.JS and the browser, limited to WebSQL's constraints (like the inability to...
Read more >
Knex.js: SQL Query Builder for Javascript
Knex.js (pronounced /kəˈnɛks/) is a "batteries included" SQL query builder for PostgreSQL, CockroachDB, MSSQL, MySQL, MariaDB, SQLite3, Better-SQLite3, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found