Packages

trait Conn extends AnyRef

Facade to Datomic Connection.

Source
Conn.scala
Linear Supertypes
AnyRef, Any
Known Subclasses
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Conn
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def _index(model: Model): Collection[List[AnyRef]]
  2. abstract def _query(model: Model, query: Query, _db: Option[DatomicDb] = None): Collection[List[AnyRef]]
  3. abstract def db: DatomicDb

    Get current test/live db.

    Get current test/live db. Test db has preference.

  4. abstract def entity(id: Any): DatomicEntity

    Convenience method to retrieve entity directly from connection.

  5. abstract def liveDbUsed: Boolean

    Flag to indicate if live database is used

  6. abstract def q(db: DatomicDb, query: String, inputs: Seq[Any]): List[List[AnyRef]]

    Query Datomic directly with db value and optional Scala inputs.

    Query Datomic directly with db value and optional Scala inputs.

    // Sample data
    Ns.str.int.get === List(
      ("Liz", 37),
      ("Ben", 42),
    )
    
    // Start out easily with a Datomic query from inspect output
    Ns.str.int.inspectGet // shows datomic query...
    
    // Paste Datomic query into `q` call and use some db value
    conn.q(conn.db,
           """[:find  ?b ?c
             | :where [?a :Ns/str ?b]
             |        [?a :Ns/int ?c]]""".stripMargin) === List(
      List("Liz", 37),
      List("Ben", 42)
    )
    
    // Modify Datomic query to see result, for instance
    // by adding input to query and applying input value
    conn.q(conn.db,
           """[:find  ?b ?c
             | :in    $ ?c
             | :where [?a :Ns/str ?b]
             |        [?a :Ns/int ?c]]""".stripMargin,
           Seq(42) // input values in list
     ) === List(
      List("Ben", 42)
    )
    db

    Any Datomic Database value (could be asOf(x) etc)

    query

    Datomic query string

    inputs

    Seq of optional input(s) to query

    returns

    List[List[AnyRef]]

  7. abstract def qRaw(db: DatomicDb, query: String, inputs0: Seq[Any]): Collection[List[AnyRef]]

    Query Datomic directly with db value and optional Scala inputs and get raw Java result.

    Query Datomic directly with db value and optional Scala inputs and get raw Java result.

    // Sample data
    Ns.str.int.get === List(
      ("Liz", 37),
      ("Ben", 42),
    )
    
    // Get some Datomic query from inspect output
    Ns.str.int.inspectGet // shows datomic query...
    
    // Paste Datomic query into `q` call and use some db value
    conn.q(conn.db,
           """[:find  ?b ?c
             | :where [?a :Ns/str ?b]
             |        [?a :Ns/int ?c]]""".stripMargin)
        .toString === """[["Liz" 37], ["Ben" 42]]"""
    
    // Modify Datomic query to see result, for instance
    // by adding input to query and applying input value
    conn.q(conn.db,
           """[:find  ?b ?c
             | :in    $ ?c
             | :where [?a :Ns/str ?b]
             |        [?a :Ns/int ?c]]""".stripMargin,
           Seq(42) // input values in list
     ).toString === """[["Ben" 42]]"""
    db

    Any Datomic Database value (could be asOf(x) etc)

    query

    Datomic query string

    inputs0

    Seq of optional input(s) to query

    returns

    java.util.Collection[java.util.List[AnyRef]]

  8. abstract def query(model: Model, query: Query): Collection[List[AnyRef]]

    Query Datomic with Model and Query to get raw Java data.

    Query Datomic with Model and Query to get raw Java data.

    Will transparently relegate query depending on Model to:

    - Datalog query execution - Datoms API accessing index - Log API accessing log

    Return type (tuple matching the molecule) is the same for all 3 APIs so that application code can query and access data of all molecules the same way.

    model

    Model instance

    query

    Query instance

    returns

    java.util.Collection[java.util.List[AnyRef]]

  9. abstract def testDb(db: DatomicDb): Unit

    Manually apply a database to use.

  10. abstract def testDbAsOf(txR: TxReport): Unit

    Use test database as of transaction report.

    Use test database as of transaction report.

    txR

    Transaction report

  11. abstract def testDbAsOf(d: Date): Unit

    Use test database as of date.

    Use test database as of date.

    d

    Date

  12. abstract def testDbAsOf(t: Long): Unit

    Use test database as of time t / tx id.

    Use test database as of time t / tx id.

    t

    Long Time t or tx id

  13. abstract def testDbAsOfNow: Unit

    Use test database as of now.

  14. abstract def testDbSince(txR: TxReport): Unit

    Use test database since transaction report.

    Use test database since transaction report.

    txR

    Transaction report

  15. abstract def testDbSince(d: Date): Unit

    Use test database since date.

    Use test database since date.

    d

    Date

  16. abstract def testDbSince(t: Long): Unit

    Use test database since time t.

    Use test database since time t.

    t

    Long

  17. abstract def testDbWith(txDataJava: List[List[AnyRef]]): Unit

    Use test database with temporary raw Java transaction data.

  18. abstract def testDbWith(txData: Seq[Seq[Statement]]*): Unit

    Use test database with temporary transaction data.

    Use test database with temporary transaction data.

    Transaction data can be supplied from any molecule:

    val benId = Person.name("Ben").save.eid
    
    // Use temporary db with given transaction data applied
    conn.testDbWith(
      Person.name("liz").getSaveTx
    )
    
    // Query using temporary database including Liz
    Person.name.get === List("Ben", "Liz")
    
    // Multiple transactions can be applied
    conn.testDbWith(
      Person.name("Joe").getSaveTx,
      benId.getRetractTx
    )
    Person.name.get === List("Liz", "Joe")
    txData

    List of List of transaction Statement's

  19. abstract def transact(javaStmts: List[_], scalaStmts: Seq[Seq[Statement]] = Nil): TxReport

    Transact edn files or other raw transaction data.

    Transact edn files or other raw transaction data.

    val data_rdr2 = new FileReader("examples/resources/seattle/seattle-data1a.dtm")
    val rawTxStmts = Util.readAll(data_rdr2).get(0).asInstanceOf[java.util.List[Object]]
    
    // transact
    val result: TxReport = conn.transact(rawTxStmts)
    javaStmts

    Raw transaction data, typically from edn file.

    returns

    TxReport

  20. abstract def transact(scalaStmts: Seq[Seq[Statement]]): TxReport

    Transact Seq of Seqs of molecule.core.ast.transactionModel.Statements

  21. abstract def transactAsync(javaStmts: List[_], scalaStmts: Seq[Seq[Statement]] = Nil)(implicit ec: ExecutionContext): Future[TxReport]

    Asynchronously transact edn files or other raw transaction data.

    Asynchronously transact edn files or other raw transaction data.

    val data_rdr2 = new FileReader("examples/resources/seattle/seattle-data1a.dtm")
    val rawTxStmts = Util.readAll(data_rdr2).get(0).asInstanceOf[java.util.List[Object]]
    
    // transact
    val result: Future[TxReport] = conn.transactAsync(rawTxStmts)
    javaStmts

    Raw transaction data, typically from edn file.

    returns

    Future with TxReport with result of transaction

  22. abstract def transactAsync(scalaStmts: Seq[Seq[Statement]])(implicit ec: ExecutionContext): Future[TxReport]

    Asynchronously transact Seq of Seqs of molecule.core.ast.transactionModel.Statements

    Asynchronously transact Seq of Seqs of molecule.core.ast.transactionModel.Statements

    returns

    TxReport

  23. abstract def useLiveDb: Unit

    Get out of test mode and back to live db.

  24. abstract def usingTempDb(tempDb: TempDb): Conn

Concrete 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 clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def getT(tx: Long): Long

    Convenience retrieval of time t.

  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. def q(query: String, inputs: Any*): List[List[AnyRef]]

    Query Datomic directly with optional Scala inputs.

    Query Datomic directly with optional Scala inputs.

    // Sample data
    Ns.str.int.get === List(
      ("Liz", 37),
      ("Ben", 42),
    )
    
    // Start out easily with a Datomic query from inspect output
    Ns.str.int.inspectGet // shows datomic query...
    
    // Paste Datomic query into `q` call
    conn.q("""[:find  ?b ?c
             | :where [?a :Ns/str ?b]
             |        [?a :Ns/int ?c]]""".stripMargin) === List(
      List("Liz", 37),
      List("Ben", 42)
    )
    
    // Modify Datomic query to see result, for instance
    // by adding input to query and applying input value
    conn.q("""[:find  ?b ?c
             | :in    $ ?c
             | :where [?a :Ns/str ?b]
             |        [?a :Ns/int ?c]]""".stripMargin, 42) === List(
      List("Ben", 42)
    )
    query

    Datomic query string

    inputs

    Optional input(s) to query

    returns

    List[List[AnyRef]]

  17. def qRaw(query: String, inputs: Any*): Collection[List[AnyRef]]

    Query Datomic directly with optional Scala inputs and get raw Java result.

    Query Datomic directly with optional Scala inputs and get raw Java result.

    // Sample data
    Ns.str.int.get === List(
      ("Liz", 37),
      ("Ben", 42),
    )
    
    // Start out easily with a Datomic query from inspect output
    Ns.str.int.inspectGet // shows datomic query...
    
    // Paste Datomic query into `q` call
    conn.q("""[:find  ?b ?c
             | :where [?a :Ns/str ?b]
             |        [?a :Ns/int ?c]]""".stripMargin)
        .toString === """[["Liz" 37], ["Ben" 42]]"""
    
    // Modify Datomic query to see result, for instance
    // by adding input to query and applying input value
    conn.q("""[:find  ?b ?c
             | :in    $ ?c
             | :where [?a :Ns/str ?b]
             |        [?a :Ns/int ?c]]""".stripMargin, 42).toString === """[["Ben" 42]]"""
    query

    Datomic query string

    inputs

    Optional input(s) to query

    returns

    java.util.Collection[java.util.List[AnyRef]]

  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped