libSQL/SQLite: Issue with CAST and ILIKE
I'm trying to cast number and date to string inside the 'where' statement. Unfortunately I'm getting a SQL syntax error around ILIKE. What's the issue with this code?:
.where(
or(
ilike(customers.name, `%${query}%`),
ilike(customers.email, `%${query}%`),
sql`CAST(invoices.amount AS TEXT) ILIKE ${`%${query}%`}`,
sql`CAST(invoices.date AS TEXT) ILIKE ${`%${query}%`}`,
ilike(invoices.status, `%${query}%`),
),
)