Packages

  • package root

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

    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.

    Definition Classes
    root
  • package core
    Definition Classes
    molecule
  • package generic
    Definition Classes
    core
  • trait GenericLog extends AnyRef

    Log interface.

    Log interface.

    Datomic's database log is a recording of all transaction data in historic order, organized for efficient access by transaction.

    Instantiate Log object with tx range arguments between from (inclusive) and until (exclusive), and add Log attributes to be returned as tuples of data:

    for {
      // Data from transaction t1 until t4 (exclusive)
      _ <- Log(Some(t1), Some(t4)).t.e.a.v.op.get.map(_ ==> List(
        (t1, e1, ":Person/name", "Ben", true),
        (t1, e1, ":Person/age", 41, true),
    
        (t2, e2, ":Person/name", "Liz", true),
        (t2, e2, ":Person/age", 37, true),
    
        (t3, e1, ":Person/age", 41, false),
        (t3, e1, ":Person/age", 42, true)
      ))
    
      // If `from` is None, the range starts from the beginning
      _ <- Log(None, Some(t3)).v.e.t.get.map(_ ==> List(
        (t1, e1, ":Person/name", "Ben", true),
        (t1, e1, ":Person/age", 41, true),
    
        (t2, e2, ":Person/name", "Liz", true),
        (t2, e2, ":Person/age", 37, true)
    
        // t3 not included
      ))
    
      // If `until` is None, the range goes to the end
      _ <- Log(Some(t2), None).v.e.t.get.map(_ ==> List(
        // t1 not included
    
        (t2, e2, ":Person/name", "Liz", true),
        (t2, e2, ":Person/age", 37, true),
    
        (t3, e1, ":Person/age", 41, false),
        (t3, e1, ":Person/age", 42, true)
      ))
    } yield ()

    Log attributes available:

    • e - Entity id (Long)
    • a - Full attribute name like ":Person/name" (String)
    • v - Value of Datoms (Any)
    • t - Transaction pointer (Long/Int)
    • tx - Transaction entity id (Long)
    • txInstant - Transaction wall clock time (java.util.Date)
    • op - Operation status: assertion (true) / retraction (false)
    Definition Classes
    generic
    Note

    Contrary to the Datomic Log which is map of individual transactions the Molecule Log implementation is flattened to be one continuous list of transaction data. This is to have a transparent unified return type as all other molecules returning data. Data can always be grouped if needed.

  • Log

object Log extends Log_0_0_L0[Log_, Init] with FirstNS

Log object to start Log molecule.

Source
GenericLog.scala
Linear Supertypes
FirstNS, Log_0_0_L0[Log_, Init], Log_0_0[Log_, Init], NS_0_00[Log_, Init], NS, Log, GenericNs, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Log
  2. FirstNS
  3. Log_0_0_L0
  4. Log_0_0
  5. NS_0_00
  6. NS
  7. Log
  8. GenericNs
  9. AnyRef
  10. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type Next[Attr[_, _], Prop, Tpe] = Attr[Log_0_1_L0[Log_, Init with Prop, Tpe], Nothing] with Log_0_1_L0[Log_, Init with Prop, Tpe]
    Definition Classes
    Log_0_0_L0
  2. type Stay[Attr[_, _], Prop, Tpe] = Attr[Log_0_0_L0[Log_, Init], Nothing] with Log_0_0_L0[Log_, Init]
    Definition Classes
    Log_0_0_L0
  3. final class a[Stay, Next] extends OneString[Stay, Next] with Indexed
    Definition Classes
    Log
  4. final class a$[Stay, Next] extends OneString$[Stay] with Indexed
    Definition Classes
    Log
  5. final class e[Stay, Next] extends OneLong[Stay, Next] with Indexed
    Definition Classes
    Log
  6. final class e$[Stay, Next] extends OneLong$[Stay] with Indexed
    Definition Classes
    Log
  7. final class op[Stay, Next] extends OneBoolean[Stay, Next] with Indexed
    Definition Classes
    Log
  8. final class op$[Stay, Next] extends OneBoolean$[Stay] with Indexed
    Definition Classes
    Log
  9. final class t[Stay, Next] extends OneLong[Stay, Next] with Indexed
    Definition Classes
    Log
  10. final class t$[Stay, Next] extends OneLong$[Stay] with Indexed
    Definition Classes
    Log
  11. final class tx[Stay, Next] extends OneLong[Stay, Next] with Indexed
    Definition Classes
    Log
  12. final class tx$[Stay, Next] extends OneLong$[Stay] with Indexed
    Definition Classes
    Log
  13. final class txInstant[Stay, Next] extends OneDate[Stay, Next] with Indexed
    Definition Classes
    Log
  14. final class txInstant$[Stay, Next] extends OneDate$[Stay] with Indexed
    Definition Classes
    Log
  15. final class v[Stay, Next] extends OneAny[Stay, Next] with Indexed
    Definition Classes
    Log
  16. final class v$[Stay, Next] extends OneAny$[Stay] with Indexed
    Definition Classes
    Log

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 lazy val a: Next[a, Log_a, String]
    Definition Classes
    Log_0_0_L0
  5. final def apply(): Log_0_0_L0[Log_, Init]
  6. final def apply(from: Option[Any]): Log_0_0_L0[Log_, Init]
  7. final def apply(from: Option[Any], until: Option[Any]): Log_0_0_L0[Log_, Init]

    Range of transactions (using Datomic's Log.txRange API)

    Range of transactions (using Datomic's Log.txRange API)

    Returns transactions between transaction points in time from (inclusive) and until (exclusive).

    Option args can be

    - Transaction point in time (t) of type Long/Int - Transaction entity id (tx) of type Long - Transaction wall clock time (txInstant) of type java.util.Date

    If from is None, transactions from beginning are fetched.
    If until is None, transaction until end are fetched.

    Molecule doesn't allow both arguments to be None since it would return the whole database. (Use Datomic raw access if that is needed)

    from

    First tx (inclusive). Beginning if None

    until

    Last tx (exclusive). End if None

    returns

    Log builder object to add generic datom attributes

  8. def apply(eids: expression.AttrExpressions.qm): AnyRef

    Add entity id(s) input placeholder to the molecule.

    Add entity id(s) input placeholder to the molecule.
    At runtime, entity id(s) are applied as vararg(s) or list/sets.

    eids

    Iterable of entity ids, typically List, Seq or Set of ids.

    returns

    molecule to be further expanded with more attributes.

    Definition Classes
    FirstNS
  9. def apply(eids: Iterable[Long]): AnyRef

    Filter molecule by applying one or more entity ids of type Long.

    Filter molecule by applying one or more entity ids of type Long.

    eids

    Iterable of entity ids, typically List, Seq or Set of ids.

    returns

    molecule to be further expanded with more attributes.

    Definition Classes
    FirstNS
  10. def apply(eid: Long, eids: Long*): AnyRef

    Filter molecule by applying one or more entity ids of type Long.

    Filter molecule by applying one or more entity ids of type Long.

    eid

    First entity id

    eids

    Further entity ids (varargs)

    returns

    molecule to be further expanded with more attributes.

    Definition Classes
    FirstNS
  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. def asc1: Log.this.type
    Definition Classes
    NS
  13. def asc2: Log.this.type
    Definition Classes
    NS
  14. def asc3: Log.this.type
    Definition Classes
    NS
  15. def asc4: Log.this.type
    Definition Classes
    NS
  16. def asc5: Log.this.type
    Definition Classes
    NS
  17. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  18. def desc1: Log.this.type
    Definition Classes
    NS
  19. def desc2: Log.this.type
    Definition Classes
    NS
  20. def desc3: Log.this.type
    Definition Classes
    NS
  21. def desc4: Log.this.type
    Definition Classes
    NS
  22. def desc5: Log.this.type
    Definition Classes
    NS
  23. final lazy val e: Next[e, Log_e, Long]
    Definition Classes
    Log_0_0_L0
  24. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  26. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  27. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  28. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  29. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  30. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  31. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  32. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  33. final lazy val op: Next[op, Log_op, Boolean]
    Definition Classes
    Log_0_0_L0
  34. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  35. final lazy val t: Next[t, Log_t, Long]
    Definition Classes
    Log_0_0_L0
  36. def toString(): String
    Definition Classes
    AnyRef → Any
  37. final lazy val tx: Next[tx, Log_tx, Long]
    Definition Classes
    Log_0_0_L0
  38. final lazy val txInstant: Next[txInstant, Log_txInstant, Date]
    Definition Classes
    Log_0_0_L0
  39. final lazy val v: Next[v, Log_v, Any]
    Definition Classes
    Log_0_0_L0
  40. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from FirstNS

Inherited from Log_0_0_L0[Log_, Init]

Inherited from Log_0_0[Log_, Init]

Inherited from NS_0_00[Log_, Init]

Inherited from NS

Inherited from Log

Inherited from GenericNs

Inherited from AnyRef

Inherited from Any

Ungrouped