com.crobox.clickhouse.ClickhouseServerVersion.scala Maven / Gradle / Ivy
package com.crobox.clickhouse
case class ClickhouseServerVersion(versions: Seq[Int]) {
def minimalVersion(version: Int): Boolean = versions.head >= version
def minimalVersion(version: Int, subVersion: Int): Boolean =
if (versions.head < version) false
else if (versions.head == version) versions(1) >= subVersion
else true
}
object ClickhouseServerVersion {
def apply(version: String): ClickhouseServerVersion =
ClickhouseServerVersion(version.split('.').toSeq.map(_.filter(_.isDigit)).filter(_.trim.nonEmpty).map(_.toInt))
def latest: ClickhouseServerVersion = ClickhouseServerVersion(versions = Seq(22, 8, 15))
}