Created
May 2, 2016 22:56
-
-
Save eishay/895f3f34cba843701f96e97b7cf3ee7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait DatabaseDialect[T <: DataBaseComponent] { | |
def day(date: DateTime): String | |
} | |
object MySqlDatabaseDialect extends DatabaseDialect[MySQL] { | |
def day(date: DateTime): String = | |
s"""STR_TO_DATE('${date.toStandardDateString}', '%Y-%m-%d')""" | |
} | |
object H2DatabaseDialect extends DatabaseDialect[H2] { | |
def day(date: DateTime): String = | |
s"""PARSEDATETIME('${date.toStandardDateString}', 'y-M-d')""" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment