Packages

  • package root

    Documentation/API for the Molecule library - a meta DSL for the Datomic database.

    Manual | scalamolecule.org | Github | Forum

    Definition Classes
    root
  • package molecule

    Molecule library - a Scala meta-DSL for the Datomic database.

    Molecule library - a Scala meta-DSL for the Datomic database.

    See api package for various api imports to start using Molecule.

    Sub-packages

    api Molecule API.
    ast Internal Molecule ASTs.
    boilerplate Internal interfaces for auto-generated DSL boilerplate code.
    composition    Builder methods to compose molecules.
    exceptions Exceptions thrown by Molecule.
    expression Attribute expressions and operations.
    facade Molecule facades to Datomic.
    factory Implicit macro methods `m` to instantiate molecules from custom DSL molecule constructs.
    input Input molecules awaiting input.
    macros Internal macros generating molecule code from custom DSL molecule constructs.
    generic Interfaces to generic information about datoms and Datomic database.
    ops Internal operational helpers for transforming DSL to molecule.
    schema Schema definition DSL.
    transform Internal transformers from DSL to Model/Query/Transaction.
    util Internal Java database functions for Datomic.

    Definition Classes
    root
  • package api
    Definition Classes
    molecule
  • trait OptionalMapOps extends AnyRef

    Container of implicit for optional Map operations.

    Container of implicit for optional Map operations.

    Definition Classes
    api
    See also

    Tests

  • OptMapAttr2MapOps
c

molecule.api.OptionalMapOps

OptMapAttr2MapOps

implicit class OptMapAttr2MapOps[T] extends AnyRef

Implicit convenience ops on Option[Map[String, T]]

Source
OptionalMapOps.scala
Linear Supertypes
AnyRef, Any
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. OptMapAttr2MapOps
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new OptMapAttr2MapOps(mapAttr: Option[Map[String, T]])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def at(key: String): Option[T]

    Extract optional value at key.

    Extract optional value at key.

    Ns.int.strMap$ insert List(
      (1, Some(Map("en" -> "Hi there"))),
      (2, Some(Map("fr" -> "Bonjour", "en" -> "Oh, Hi"))),
      (3, Some(Map("da" -> "Hejsa")))
    )
    
    // Value from key with flatMap and get
    Ns.int.strMap$.get.map { case (i, s) => (i, s.flatMap(_.get("en"))) } === List(
      (1, Some("Hi there")),
      (2, Some("Oh, Hi")),
      (3, None)
    )
    
    // Value `at` key convenience method
    Ns.int.strMap$.get.map { case (i, s) => (i, s.at("en")) } === List(
      (1, Some("Hi there")),
      (2, Some("Oh, Hi")),
      (3, None)
    )
    key

    Key of key/value pairs to look for

    returns

    Optional value

  6. def atOrElse(key: String, default: T): T

    Extract value at key or a default value.

    Extract value at key or a default value.

    Ns.int.strMap$ insert List(
      (1, Some(Map("en" -> "Hi there"))),
      (2, Some(Map("fr" -> "Bonjour", "en" -> "Oh, Hi"))),
      (3, Some(Map("da" -> "Hejsa")))
    )
    
    // Value `at` key or default value
    Ns.int.strMap$.get.map { case (i, s) => (i, s.atOrElse("en", "Default")) } === List(
      (1, "Hi there"),
      (2, "Oh, Hi"),
      (3, "Default")
    )
    key

    Key to match

    default

    Default value if key is not found

    returns

    Value if present, otherwise default value supplied

  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def keyValue(keyValueRegExs: (String, T)*): Map[String, T]

    Maps filtered by pairs of (key -> value-regex).

    Maps filtered by pairs of (key -> value-regex).

    Ns.int.strMap$ insert List(
      (1, Some(Map("en" -> "Hi there"))),
      (2, Some(Map("fr" -> "Bonjour", "en" -> "Oh, Hi"))),
      (4, Some(Map("da" -> "Hejsa")))
    )
    
    // Maps filtered by key and value
    Ns.int.strMap$.get.map { case (i, s) => (i, s.keyValue("en" -> "he")) } === List(
      (1, Map("en" -> "Hi there")),
      (2, Map()),
      (3, Map())
    )
    keyValueRegExs

    One or more (key -> value-regex) pairs

    returns

    Maps filtered by keys/regexes

  15. def keyValues(keyValuesRegEx: (String, Seq[T]), keyValuesRegExs: (String, Seq[T])*): Map[String, T]

    Maps filtered by pairs of (key -> Seq(value-regexes)).

    Maps filtered by pairs of (key -> Seq(value-regexes)).

    Ns.int.strMap$ insert List(
      (1, Some(Map("en" -> "Hi there"))),
      (2, Some(Map("fr" -> "Bonjour", "en" -> "Oh, Hi"))),
      (3, Some(Map("da" -> "Hejsa")))
    )
    
    // Maps filtered by key and value
    Ns.int.strMap$.get.map { case (i, s) => (i, s.keyValues("en" -> Seq("he", "hi"))) } === List(
      (1, Map("en" -> "Hi there")),
      (2, Map("en" -> "Oh, Hi")),
      (3, Map())
    )
    keyValuesRegEx

    (key -> Seq(value-regex)) pair

    keyValuesRegExs

    Optional further (key -> Seq(value-regex)) pairs

    returns

    Map filtered by keys/regexes

  16. def mapAt(key1: String, keyN: String*): Map[String, T]

    Maps filtered by keys.

    Maps filtered by keys.

    Ns.int.strMap$ insert List(
      (1, Some(Map("en" -> "Hi there"))),
      (2, Some(Map("fr" -> "Bonjour", "en" -> "Oh, Hi"))),
      (3, Some(Map("da" -> "Hejsa")))
    )
    
    // Map values filtered by keys
    Ns.int.strMap$.get.map { case (i, s) => (i, s.mapAt("fr", "da")) } === List(
      (1, Map()),
      (2, Map("fr" -> "Bonjour")),
      (3, Map("da" -> "Hejsa"))
    )
    key1

    Key to match

    keyN

    Optional further keys to match

    returns

    Maps filtered with pairs matching keys

  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. def values(valueRegEx: T, valueRegExs: T*): Map[String, T]

    Maps filtered by regexes on values.

    Maps filtered by regexes on values.

    Ns.int.strMap$ insert List(
      (1, Some(Map("en" -> "Hi there"))),
      (2, Some(Map("fr" -> "Bonjour", "en" -> "Oh, Hi"))),
      (3, Some(Map("da" -> "Hejsa")))
    )
    
    // Maps filtered by regex on values
    Ns.int.strMap$.get.map { case (i, s) => (i, s.values("jou")) } === List(
      (1, Map()),
      (2, Map("fr" -> "Bonjour")),
      (3, Map())
    )
    
    // Maps filtered by regexes on value
    Ns.int.strMap$.get.map { case (i, s) => (i, s.values("jou", "hej")) } === List(
      (1, Map()),
      (2, Map("fr" -> "Bonjour")),
      (3, Map("da" -> "Hejsa"))
    )
    valueRegEx

    Regex on values

    valueRegExs

    Optional further regexes on values

    returns

    Map with pairs having values matching regexes

  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped