diff --git a/mysql/src/main/scala/zio/sql/mysql/MysqlSqlModule.scala b/mysql/src/main/scala/zio/sql/mysql/MysqlSqlModule.scala index 6b9d2034d..162c73574 100644 --- a/mysql/src/main/scala/zio/sql/mysql/MysqlSqlModule.scala +++ b/mysql/src/main/scala/zio/sql/mysql/MysqlSqlModule.scala @@ -31,6 +31,7 @@ trait MysqlSqlModule extends Sql { self => val CurrentDate = Expr.ParenlessFunctionCall0[LocalDate](FunctionName("current_date")) val CurrentTime = Expr.ParenlessFunctionCall0[OffsetTime](FunctionName("current_time")) val Degrees = FunctionDef[Double, Double](FunctionName("degrees")) + val Hex = FunctionDef[Long, String](FunctionName("hex")) val Log2 = FunctionDef[Double, Double](FunctionName("log2")) val Log10 = FunctionDef[Double, Double](FunctionName("log10")) val MakeTime = FunctionDef[(Int, Int, Double), LocalTime](FunctionName("maketime")) diff --git a/mysql/src/test/scala/zio/sql/mysql/FunctionDefSpec.scala b/mysql/src/test/scala/zio/sql/mysql/FunctionDefSpec.scala index 671ac0cc7..0d76ed157 100644 --- a/mysql/src/test/scala/zio/sql/mysql/FunctionDefSpec.scala +++ b/mysql/src/test/scala/zio/sql/mysql/FunctionDefSpec.scala @@ -96,6 +96,13 @@ object FunctionDefSpec extends MysqlRunnableSpec with ShopSchema { assertion.mapErrorCause(cause => Cause.stackless(cause.untraced)) }, + test("hex") { + val query = select(Hex(255L)) from customers + val expected = "FF" + val queryResult = execute(query) + + assertZIO(queryResult.runHead.some)(equalTo(expected)) + }, test("log2") { val query = select(Log2(8d)) from customers