mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
Failing test for literal expression function
This commit is contained in:
1 parent
d190a26737
commit
cc495e3fd5
1 file changed
+12
@@ -473,6 +473,18 @@ extension SQLLiteralTests {
|
||||
SELECT * FROM "player" WHERE (DATE("createdAt")) = '2020-01-23'
|
||||
""")
|
||||
}
|
||||
|
||||
do {
|
||||
// Here we test that users can define functions that return literal expressions
|
||||
func date(_ value: SQLExpressible) -> SQLExpression {
|
||||
SQLLiteral("DATE(\(value))").sqlExpression
|
||||
}
|
||||
let createdAt = Column("createdAt")
|
||||
let request = Player.filter(date(createdAt) == "2020-01-23")
|
||||
try assertEqualSQL(db, request, """
|
||||
SELECT * FROM "player" WHERE (DATE("createdAt")) = '2020-01-23'
|
||||
""")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user