fly4s.data.ValidateOutput.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fly4s_3 Show documentation
Show all versions of fly4s_3 Show documentation
A functional wrapper for Flywayy
The newest version!
package fly4s.data
import cats.Show
object ValidateOutput extends ValidateOutputInstances {
def asPrettyString(error: ValidateOutput): String =
s"""
|Failed validation:
| - version: ${error.version}
| - path: ${error.filepath}
| - description: ${error.description}
| - errorCode: ${error.errorDetails.errorCode}
| - errorMessage: ${error.errorDetails.errorMessage}
""".stripMargin
}
trait ValidateOutputInstances {
implicit val showInstanceForValidateOutput: Show[ValidateOutput] = (v: ValidateOutput) =>
ValidateOutput.asPrettyString(v)
implicit def showInstanceForValidateOutputList(implicit
S: Show[ValidateOutput]
): Show[Iterable[ValidateOutput]] =
(vs: Iterable[ValidateOutput]) =>
vs
.map(S.show)
.toList
.mkString("\n\n")
}