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

org.sisioh.aws4s.dynamodb.document.RichPrimaryKey.scala Maven / Gradle / Ivy

There is a newer version: 1.0.16
Show newest version
package org.sisioh.aws4s.dynamodb.document

import com.amazonaws.services.dynamodbv2.document.{ KeyAttribute, PrimaryKey }
import org.sisioh.aws4s.PimpedType

import scala.collection.JavaConverters._

object PrimaryKeyFactory {

  def apply(): PrimaryKey = new PrimaryKey()

  def apply(components: KeyAttribute*): PrimaryKey = new PrimaryKey(components: _*)

  def apply(hashKeyName: String, hashKeyValue: AnyRef): PrimaryKey = new PrimaryKey(hashKeyName, hashKeyValue)

  def apply(hashKeyName: String, hashKeyValue: AnyRef, rangeKeyName: String, rangeKeyValue: AnyRef): PrimaryKey =
    new PrimaryKey(hashKeyName, hashKeyValue, rangeKeyName, rangeKeyValue)

}

class RichPrimaryKey(val underlying: PrimaryKey) extends AnyVal with PimpedType[PrimaryKey] {

  def components: Iterable[KeyAttribute] = underlying.getComponents.asScala.toVector

  def componentNameSet: Set[String] = underlying.getComponentNameSet.asScala.toSet

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy