mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-21 21:14:12 +08:00
This commit is contained in:
parent
e4545f537a
commit
7abbee27e5
@ -6,6 +6,7 @@
|
||||
package com.mysema.query.scala;
|
||||
|
||||
import com.mysema.query.alias.Alias._
|
||||
import com.mysema.query.types.expr._
|
||||
import com.mysema.query.types.path._
|
||||
|
||||
/**
|
||||
@ -14,6 +15,8 @@ import com.mysema.query.types.path._
|
||||
*/
|
||||
object Conversions {
|
||||
|
||||
def not(b: EBoolean): EBoolean = b.not()
|
||||
|
||||
implicit def _boolean(b: Boolean): PBoolean = $(b);
|
||||
|
||||
implicit def _string(s: String): PString = $(s);
|
||||
|
||||
@ -32,6 +32,21 @@ class AliasTest {
|
||||
assertEquals("domainType.firstName like Hello", (domainType.firstName like "Hello").toString());
|
||||
assertEquals("domainType.firstName ASC", (domainType.firstName asc).toString());
|
||||
|
||||
// and
|
||||
var andClause = (domainType.firstName like "An%") and (domainType.firstName like "Be%");
|
||||
assertEquals("domainType.firstName like An% && domainType.firstName like Be%", andClause.toString);
|
||||
|
||||
// or
|
||||
var orClause = (domainType.firstName like "An%") or (domainType.firstName like "Be%");
|
||||
assertEquals("domainType.firstName like An% || domainType.firstName like Be%", orClause.toString);
|
||||
|
||||
// not
|
||||
var notClause = (domainType.firstName like "An%") not;
|
||||
assertEquals("!domainType.firstName like An%", notClause.toString);
|
||||
|
||||
notClause = not (domainType.firstName like "An%");
|
||||
assertEquals("!domainType.firstName like An%", notClause.toString);
|
||||
|
||||
// FIXME : "eq" and "ne" are already reserved
|
||||
// assertEquals("domainType.firstName = Hello", (domainType.firstName eq "Hello").toString());
|
||||
// assertEquals("domainType.firstName != Hello", (domainType.firstName ne "Hello").toString());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user