简体   繁体   中英

As we are writing %like% in SQL to match some details, how we can implement the %like% in gosu query?

var pp = gw.api.database.Query.make(entity.PolicyPeriod)

What is the syntax we can use for %like% which we have already been used in SQL to match elements?

Please help me to find the implementation

You can use contains function with 3 parameters, first the Column, second the input value and third a boolean value to ignoreCase (true for denorm the input and column value).

Query.make(PolicyPeriod).contains(PolicyPeriod#PolicyNumber, "123A", true)

Produces

[%123a%]

SELECT FROM bc_policyperiod gRoot WHERE gRoot.PolicyNumberDenorm LIKE ? AND gRoot.Retired = 0

您可以使用上面提到的.contains,并且还有.startsWith(),它将在SQL中执行与LIKE%文本相同的操作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM