class Conn extends Helpers with BridgeDatomicFuture
Facade to Datomic Connection.
- Source
- Conn.scala
- See also
Manual | Tests: testDbAsOf, testDbSince, testDbWith,
- Alphabetic
- By Inheritance
- Conn
- BridgeDatomicFuture
- Helpers
- DateHandling
- RegexMatching
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Conn(datomicConn: Connection)
Type Members
- implicit class Regex extends AnyRef
- Definition Classes
- RegexMatching
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def cast(value: Any): String
- Attributes
- protected
- Definition Classes
- Helpers
- def clean(attr: String): String
- Definition Classes
- Helpers
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def date2datomicStr(date: Date, zoneOffset: ZoneOffset = localZoneOffset): String
- Definition Classes
- DateHandling
- def date2str(date: Date, zoneOffset: ZoneOffset = localZoneOffset): String
- Definition Classes
- DateHandling
- val datomicConn: Connection
- def daylight(ms: Long): Int
- Definition Classes
- DateHandling
- def db: Database
Get current test/live db.
Get current test/live db. Test db has preference.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def escStr(s: String): String
- Definition Classes
- Helpers
- def expandDateStr(dateStr: String): String
- Definition Classes
- DateHandling
- final def f(a: Any): Any
- Attributes
- protected
- Definition Classes
- Helpers
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def liveDbUsed: Boolean
Flag to indicate if live database is used
- lazy val localOffset: String
- Definition Classes
- DateHandling
- lazy val localZoneOffset: ZoneOffset
- Definition Classes
- DateHandling
- val log: Logger
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def o(opt: Option[Any]): String
- Attributes
- protected
- Definition Classes
- Helpers
- final def os(opt: Option[Set[_]]): String
- Attributes
- protected
- Definition Classes
- Helpers
- def q(db: Database, 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 debug output Ns.str.int.debugGet // 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]]
- 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 debug output Ns.str.int.debugGet // 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]]
- def qRaw(db: Database, 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 debug output Ns.str.int.debugGet // 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]]
- 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 debug output Ns.str.int.debugGet // 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]]
- 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.
- final def seq[T](values: Seq[T]): String
- Attributes
- protected
- Definition Classes
- Helpers
- def str2date(s: String, zoneOffset: ZoneOffset = localZoneOffset): Date
- Definition Classes
- DateHandling
- def str2zdt(s: String, zoneOffset: ZoneOffset = localZoneOffset): ZonedDateTime
- Definition Classes
- DateHandling
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def testDb(db: Database): Unit
Manually apply a database to use.
- def testDbAsOf(txR: TxReport): Unit
Use test database as of transaction report.
Use test database as of transaction report.
- txR
Transaction report
- def testDbAsOf(d: Date): Unit
Use test database as of date.
Use test database as of date.
- d
Date
- def testDbAsOf(t: Long): Unit
Use test database as of time t.
Use test database as of time t.
- t
Long
- def testDbAsOfNow: Unit
Use test database as of now.
- def testDbSince(txR: TxReport): Unit
Use test database since transaction report.
Use test database since transaction report.
- txR
Transaction report
- def testDbSince(d: Date): Unit
Use test database since date.
Use test database since date.
- d
Date
- def testDbSince(t: Long): Unit
Use test database since time t.
Use test database since time t.
- t
Long
- def testDbWith(txDataJava: List[List[AnyRef]]): Unit
Use test database with temporary raw Java transaction data.
- 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
- final def time(n: Int, prev: Int = 0): Unit
- Attributes
- protected
- Definition Classes
- Helpers
- def toString(): String
- Definition Classes
- AnyRef → Any
- def transact(rawTxStmts: List[AnyRef]): 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)
- rawTxStmts
Raw transaction data, typically from edn file.
- returns
- def transact(stmtss: Seq[Seq[Statement]]): TxReport
- def transactAsync(rawTxStmts: List[AnyRef])(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)
- rawTxStmts
Raw transaction data, typically from edn file.
- returns
Future with TxReport with result of transaction
- def transactAsync(stmtss: Seq[Seq[Statement]])(implicit ec: ExecutionContext): Future[TxReport]
- def truncateDateStr(dateStr: String): String
- Definition Classes
- DateHandling
- final def tupleToSeq(arg: Any): Seq[Any]
- Attributes
- protected
- Definition Classes
- Helpers
- def unescStr(s: String): String
- Definition Classes
- Helpers
- def useLiveDb: Unit
Get out of test mode and back to live db.
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- lazy val zone: ZoneId
- Definition Classes
- DateHandling
- object mkDate
- Attributes
- protected
- Definition Classes
- Helpers
Documentation/API for the Molecule library - a meta DSL for the Datomic database.
Manual | scalamolecule.org | Github | Forum