clean code

This commit is contained in:
2021-07-18 02:42:09 +02:00
parent ab1422ec16
commit 11cff350ed
2 changed files with 15 additions and 52 deletions

View File

@@ -1,6 +1,5 @@
package fr.postgresjson.definition
import java.io.File
import java.nio.file.Path
class Function(
@@ -70,21 +69,4 @@ class Function(
infix fun `is different from`(other: Function): Boolean {
return other.script != this.script
}
companion object {
fun build(source: File): List<Function> {
return source.readText()
.split(
"CREATE +(OR REPLACE +)?(PROCEDURE|FUNCTION)".toRegex(
setOf(
RegexOption.IGNORE_CASE,
RegexOption.MULTILINE
)
)
)
.map {
Function("CREATE OR REPLACE FUNCTION $it")
}
}
}
}