Skip to content

Commit

Permalink
Merge pull request #688 from vidyasankarv/#675
Browse files Browse the repository at this point in the history
#675 - Add uuid() function to MySqlModule
  • Loading branch information
sviezypan authored May 26, 2022
2 parents 33a9e27 + e56958b commit 9b6b455
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mysql/src/main/scala/zio/sql/mysql/MysqlSqlModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package zio.sql.mysql

import java.sql.ResultSet
import java.time.{ LocalDate, LocalTime, OffsetTime, Year, ZonedDateTime }
import java.util.UUID
import zio.sql.Sql

trait MysqlSqlModule extends Sql { self =>
Expand All @@ -21,7 +22,6 @@ trait MysqlSqlModule extends Sql { self =>
r => Right(r)
)
}

}
}

Expand All @@ -39,6 +39,6 @@ trait MysqlSqlModule extends Sql { self =>
val Pi = Expr.FunctionCall0[Double](FunctionDef[Any, Double](FunctionName("pi")))
val Rand = FunctionDef[Int, Double](FunctionName("rand"))
val RPad = FunctionDef[(String, Int, String), String](FunctionName("rpad"))
val Uuid = Expr.FunctionCall0[UUID](FunctionDef[Any, UUID](FunctionName("uuid")))
}

}
3 changes: 3 additions & 0 deletions mysql/src/test/scala/zio/sql/mysql/FunctionDefSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ object FunctionDefSpec extends MysqlRunnableSpec with ShopSchema {

assertZIO(testResult.runHead.some)(equalTo(expected))
},
test("uuid") {
assertZIO(execute(select(Uuid)).runHead.some)(!isNull)
},
test("rand") {
val query = select(Rand(5))

Expand Down

0 comments on commit 9b6b455

Please sign in to comment.