trait Conn extends ColOps with BooPicklers
Facade to Datomic Connection.
Has additional internal state to manage using adhoc and test databases.
- Source
- Conn.scala
- Alphabetic
- By Inheritance
- Conn
- BooPicklers
- Helpers
- ColOps
- DateHandling
- RegexMatching
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
Abstract Value Members
-
abstract
def
db(implicit ec: ExecutionContext): Future[DatomicDb]
Get current adhoc/test/live db.
-
abstract
def
sync(t: Long): Conn
Synchronize database to have all transactions completed up to and including time t.
Synchronize database to have all transactions completed up to and including time t.
Sets a flag with a time t on the connection to do the synchronization on the first subsequent query. Hereafter the flag is removed.
The synchronization guarantees to include all transactions that are complete up to and including time t.
syncdoes not communicate with the transactor, but it can block (within the Future) if the peer/client has not yet been notified of transactions up to time t.A Future with the synchronized database is returned for the query to use. The future can take arbitrarily long to complete. Waiting code should specify a timeout.
Only use
sync(t)when coordination of multiple peer/client processes is required.If peers/clients do not share a basis t, prefer
sync.- returns
Connection with synchronization flag set
-
abstract
def
sync: Conn
Synchronize database to have all transactions completed up until now.
Synchronize database to have all transactions completed up until now.
Sets a flag on the connection to do the synchronization on the first subsequent query. Hereafter the flag is removed.
The synchronization guarantees to include all transactions that are complete when the synchronization query is made. Before the query is executed, the connection communicates with the transactor to do the synchronization.
A Future with the synchronized database is returned for the query to use. The future can take arbitrarily long to complete. Waiting code should specify a timeout.
Only use
syncwhen the following two conditions hold:- coordination of multiple peer/client processes is required 2. peers/clients have no way to agree on a basis t for coordination
- returns
Connection with synchronization flag set
-
abstract
def
testDbAsOf(txR: TxReport)(implicit ec: ExecutionContext): Future[Unit]
Use test database as of transaction report.
Use test database as of transaction report.
- txR
Transaction report
-
abstract
def
testDbAsOf(d: Date)(implicit ec: ExecutionContext): Future[Unit]
Use test database as of date.
Use test database as of date.
- d
Date
-
abstract
def
testDbAsOf(t: Long)(implicit ec: ExecutionContext): Future[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
-
abstract
def
testDbAsOfNow(implicit ec: ExecutionContext): Future[Unit]
Use test database as of now.
-
abstract
def
testDbSince(txR: TxReport)(implicit ec: ExecutionContext): Future[Unit]
Use test database since transaction report.
Use test database since transaction report.
- txR
Transaction report
-
abstract
def
testDbSince(d: Date)(implicit ec: ExecutionContext): Future[Unit]
Use test database since date.
Use test database since date.
- d
Date
-
abstract
def
testDbSince(t: Long)(implicit ec: ExecutionContext): Future[Unit]
Use test database since time t.
Use test database since time t.
- t
Long
-
abstract
def
testDbWith(txMolecules: Future[Seq[Statement]]*)(implicit ec: ExecutionContext): Future[Unit]
Use test database with temporary transaction statements.
Use test database with temporary transaction statements.
Transaction statements can be supplied from a molecule:for { conn <- futConn // implicit Future[Conn] instance in scope // Live data benId = Person.name("Ben").save.map(_.eid) // Use temporary db with statements of one or more tested transactions _ <- conn.testDbWith( Person.name("liz").getSaveStmts, benId.getRetractStmts // more... ) // Query using temporary database _ <- Person.name.get.map(_ ==> List("Liz")) // Discard test db and go back to live db _ = conn.useLiveDb() // Query using unchanged live data _ <- Person.name.get.map(_ ==> List("Ben")) } yield ()
- txMolecules
List of List of transaction Statement's
-
abstract
def
transact(edn: String)(implicit ec: ExecutionContext): Future[TxReport]
Transact EDN data string
Transact EDN data string
- edn
EDN transaction data string
- ec
ExecutionContext for Future
- returns
Future with TxReport
-
abstract
def
useLiveDb(): Unit
Get out of test mode and back to live db.
Concrete 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
-
implicit
val
anyPickler: Pickler[Any]
- Definition Classes
- BooPicklers
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
bigDec(arg: Any): BigDecimal
- Attributes
- protected
- Definition Classes
- Helpers
-
implicit
def
boopickleSerializerDeserializer[T](implicit arg0: boopickle.Default.Pickler[T]): SerializerDeserializer[T, ByteBuffer]
- Definition Classes
- BooPicklers
-
def
clean(attr: String): String
- Definition Classes
- Helpers
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
implicit
val
connProxyPickler: CompositePickler[ConnProxy]
- Definition Classes
- BooPicklers
-
def
convert(tpe: String, arg: Any): (Any) ⇒ String
- Definition Classes
- ColOps
-
def
date2datomicStr(date: Date, zoneOffset: ZoneOffset = localZoneOffset): String
- Definition Classes
- DateHandling
-
def
date2datomicStr2(date: Date, zoneOffset: ZoneOffset = localZoneOffset): String
- Definition Classes
- DateHandling
-
def
date2str(date: Date, zoneOffset: ZoneOffset = localZoneOffset): String
- Definition Classes
- DateHandling
-
implicit
val
datePickler: Pickler[Date]
- Definition Classes
- BooPicklers
-
def
daylight(ms: Long): Int
- Definition Classes
- DateHandling
-
def
debug(prefix: String, suffix: String = ""): Unit
- Attributes
- protected
-
def
double(arg: Any): String
- Attributes
- protected
- Definition Classes
- Helpers
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
escStr(s: String): String
- Definition Classes
- Helpers
-
implicit
val
exPickler: CompositePickler[Throwable]
- Definition Classes
- BooPicklers
-
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] )
-
def
firstNs(model: Model): String
- Definition Classes
- Helpers
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getKwName(kw: String): String
- Definition Classes
- Helpers
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
jsNumber(tpe: String, v: Any): Any
- Definition Classes
- Helpers
-
def
jsOnly(method: String): MoleculeException
- Attributes
- protected
-
def
jvmOnly(method: String): MoleculeException
- Attributes
- protected
-
def
jvmPeerOnly(method: String): MoleculeException
- Attributes
- protected
-
def
localOffset: String
- Definition Classes
- DateHandling
-
def
localZoneOffset: ZoneOffset
- Definition Classes
- DateHandling
-
def
marshallInputs(q: Query): (Seq[(Int, String, String)], Seq[(Int, String, Seq[String])], Seq[(Int, String, Seq[Seq[String]])])
- Definition Classes
- ColOps
-
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
- Definition Classes
- Helpers
-
final
def
os(opt: Option[Set[_]]): String
- Definition Classes
- Helpers
-
def
pad(longest: Int, shorter: Int): String
- Definition Classes
- Helpers
-
def
padS(longest: Int, str: String): String
- Definition Classes
- Helpers
-
def
peerOnly(method: String): MoleculeException
- Attributes
- protected
-
def
query(datalogQuery: String, inputs: Any*)(implicit ec: ExecutionContext): Future[List[List[AnyRef]]]
Query Datomic directly with Datalog query and optional Scala inputs.
Query Datomic directly with Datalog query and optional Scala inputs.
for { conn <- futConn // implicit Future[Conn] instance in scope // Typed tuple result from molecule _ <- Ns.str.int.get.map(_ ==> List( ("Liz", 37), ("Ben", 42), )) // Any-type result from query _ <- conn.query( "[:find ?b ?c :where [?a :Ns/str ?b][?a :Ns/int ?c]]" ).map(_ ==> List( List("Liz", 37), List("Ben", 42) )) // Any-type result from query with input(s) _ <- conn.query( "[:find ?b ?c :in $ ?c :where [?a :Ns/str ?b][?a :Ns/int ?c]]", 42 ).map(_ ==> List( List("Ben", 42) )) // See datalog queries of molecules with `inspectGet` _ <- Ns.str.int.inspectGet // shows Datalog query... } yield ()
- datalogQuery
Datomic query string
- inputs
Optional input(s) to query
- returns
Future[List[List[AnyRef]]]
-
final
def
render(value: Any): String
- Definition Classes
- Helpers
-
final
def
sq[T](values: Seq[T]): String
- Definition Classes
- Helpers
- def stmts2java(stmts: Seq[Statement]): List[List[_]]
-
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
thousands(i: Long): String
- Definition Classes
- Helpers
-
final
def
time(n: Int, prev: Int = 0): Unit
- Attributes
- protected
- Definition Classes
- Helpers
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
transact(javaStmts: List[_])(implicit ec: ExecutionContext): Future[TxReport]
Transact java statements
Transact java statements
Only works on jvm platform.
- returns
Future with TxReport
-
def
transact(stmtsReader: Reader)(implicit ec: ExecutionContext): Future[TxReport]
Transact statements from a java.util.Reader
Transact statements from a java.util.Reader
Only works on jvm platform.
- stmtsReader
java.io.Reader
- returns
Future with 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
-
final
def
untupled(rawData: Iterable[Seq[Any]]): Iterable[Seq[Any]]
- Definition Classes
- Helpers
-
implicit
val
uriPickler: Pickler[URI]
- Definition Classes
- BooPicklers
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
zone: ZoneId
- Definition Classes
- DateHandling

Documentation/API for the Molecule library - a meta DSL for the Datomic database.
scalamolecule.org | Github | Forum