WARNING: Be aware of SQL injection vulnerability.
Rerturns an optional SQLSyntax which is flatten (from option array) and joined with 'and'.
Rerturns an optional SQLSyntax which is flatten (from option array) and joined with 'and'.
val cond: Option[SQLSyntax] = SQLSyntax.toAndConditionOpt(Some(sqls"id = $id"), None, Some(sqls"name = $name")) cond.get.statement // "id = ? or (name = ? or name is null)" cond.get.parameters // Seq(123, "Alice")
Rerturns an optional SQLSyntax which is flatten (from option array) and joined with 'or'.
Rerturns an optional SQLSyntax which is flatten (from option array) and joined with 'or'.
val cond: Option[SQLSyntax] = SQLSyntax.toOrConditionOpt(Some(sqls"id = $id"), None, Some(sqls"name = $name")) cond.get.statement // "id = ? or (name = ? or name is null)" cond.get.parameters // Seq(123, "Alice")