<commit_before>package io.vamp.persistence

import io.vamp.common.ClassMapper

import scala.concurrent.Future

class PostgresPersistenceActorMapper extends ClassMapper {
  val name = "postgres"
  val clazz = classOf[PostgresPersistenceActor]
}

class PostgresPersistenceActor extends SqlPersistenceActor with SqlStatementProvider {

  protected def info() = Future.successful(representationInfo() + ("type" → "postgres") + ("url" → url))

  override def getInsertStatement(content: Option[String]): String =
    content.map { _ ⇒
      "insert into Artifacts (Version, Command, Type, Name, Definition) values (?, ?, ?, ?, ?)"
    }.getOrElse("insert into Artifacts (Version, Command, Type, Name) values (?, ?, ?, ?)")

  override def getSelectStatement(lastId: Long): String =
    s"SELECT ID, Command, Type, Name, Definition FROM Artifacts WHERE ID > $lastId ORDER BY ID ASC"

  override val statementMinValue: Int = 0
}<commit_msg>Add comments<commit_after>package io.vamp.persistence

import io.vamp.common.ClassMapper

import scala.concurrent.Future

/**
 * Maps postgres to class mapper for lifter
 */
class PostgresPersistenceActorMapper extends ClassMapper {
  val name = "postgres"
  val clazz = classOf[PostgresPersistenceActor]
}

/**
 * Support for PostgresSQL
 */
class PostgresPersistenceActor extends SqlPersistenceActor with SqlStatementProvider {

  protected def info() = Future.successful(representationInfo() + ("type" → "postgres") + ("url" → url))

  override def getInsertStatement(content: Option[String]): String =
    content.map { _ ⇒
      "insert into Artifacts (Version, Command, Type, Name, Definition) values (?, ?, ?, ?, ?)"
    }.getOrElse("insert into Artifacts (Version, Command, Type, Name) values (?, ?, ?, ?)")

  override def getSelectStatement(lastId: Long): String =
    s"SELECT ID, Command, Type, Name, Definition FROM Artifacts WHERE ID > $lastId ORDER BY ID ASC"

  // In Postgres the minvalue of a select statement fetch is 0
  override val statementMinValue: Int = 0
}
{'fraction_non_alphanumeric': 0.11215880893300248, 'fraction_numerical': 0.001488833746898263, 'mean_word_length': 4.826589595375722, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4823684', 'n_tokens_mistral': 595, 'n_tokens_neox': 575, 'n_words': 184}