SqlKata Query Builder provides WhereStarts, WhereEnds, WhereContains and WhereLike methods to deal with string like types.
By default all string operations are case insensitive, by applying the database LOWER() and converting the value provided to lowercase.
To override this behavior you can pass a boolean true to the last parameter caseSensitive of these methods.
//:playground
new Query("Posts").WhereEnds("Title", "Book")
SELECT * FROM [Posts] WHERE LOWER([Title]) LIKE '%book'
Using the case sensitive overload
new Query("Posts").WhereStarts("Title", "Book", true)
SELECT * FROM [Posts] WHERE [Title] LIKE Book%
Using the native WhereLike method
new Query("Posts").WhereLike("Title", "Book")
SELECT * FROM "Posts" WHERE LOWER("Title") LIKE 'book'
Note: in
WhereLikemethod, you have to put the wildcard%by yourself
You can also add an optional escape clause to all of the LIKE queries using the escapeCharacter argument:
new Query("Posts").WhereLike("Title", @"%The \% Sign%", escapeCharacter=@"\")
SELECT * FROM "Posts" WHERE LOWER("Title") LIKE '%The \% Sign%' ESCAPE '\'