All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.crobox.clickhouse.dsl.schemabuilder.TTL.scala Maven / Gradle / Ivy

There is a newer version: 1.2.5
Show newest version
package com.crobox.clickhouse.dsl.schemabuilder

import com.crobox.clickhouse.dsl.Column

/**
 * https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/mergetree/#table_engine-mergetree-ttl
 *
 * Expressions must evaluate to Date or DateTime data type
 */
case class TTL(column: Column, expression: String) {
  override def toString: String = s"${column.name} + INTERVAL $expression"
}

object TTL {

  def ttl(expressions: Iterable[TTL]): Option[String] =
    if (expressions.nonEmpty) Option("TTL " + expressions.mkString(", ")) else None
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy