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.
    generic Interfaces to generic information about datoms and Datomic database.
    input Input molecules awaiting input.
    macro Internal macros generating molecule code from custom DSL molecule constructs.
    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

    Public interface to be imported to use Molecule.

    Public interface to be imported to use Molecule.

    To make the Molecule macro materializations as fast as possible we try to import as few macro implicits as possible. If your application code build molecules with at the most 10 attributes, then you can do the following import to start using Molecule:

    import molecule.api.out10._

    out means "output molecule" , and 10 the maximum arity or number of attributes of your molecules.

    If you use input molecules awaiting an input then you can add inX where X is how many inputs (1, 2 or 3) you will use, for instance:

    import molecule.api.in2_out10._

    This way we keep the implicit macro def lookups to a minimum and compilation speed as fast as possible.

    Arities can be changed anytime you like. But not to a lower arity than that of the molecules you use in scope of the import.

    Definition Classes
    molecule
  • trait Molecule[Tpl] extends MoleculeBase with CastHelpers[Tpl] with JsonBuilder with GetArray[Tpl] with GetIterable[Tpl] with GetList[Tpl] with GetRaw with GetJson with GetAsyncArray[Tpl] with GetAsyncIterable[Tpl] with GetAsyncList[Tpl] with GetAsyncRaw with GetAsyncJson with ShowDebug[Tpl]

    Core molecule interface defining actions that can be called on molecules.

    Core molecule interface defining actions that can be called on molecules.

    Groups of interfaces:

    get getAsync Get molecule data.
    getAsOf getAsyncAsOf Get molecule data asOf point in time.
    getSince getAsyncSince Get molecule data since point in time.
    getWith getAsyncWith Get molecule data with given data set.
    getHistory getAsyncHistory     Get molecule data from history of database.
    save saveAsync Save molecule with applied data.
    insert insertAsync Insert multiple rows of data matching molecule.
    update updateAsync Update molecule with applied data.
    tx Molecule transaction data (input to `getWith`).
    debug get Debug calling get method on molecule.
    debug operation     Debug calling save/insert/update method on molecule.

    Tpl

    Type of molecule (tuple of its attribute types)

    Definition Classes
    api
    See also

    For retract ("delete") methods, see EntityOps and Entity.

    Manual: get, time, asOf/since, history, with, getJson, debug/test, save, insert, update, retract

    Tests: get, asOf, since, history, with, test asOf, test since, test with, getJson, save, insert, retract,

    update, update map, update ref, update multiple attributes, update multiple entities

  • checkInsertModel
  • debugInsert
  • getInsertTx
  • insert
  • insertAsync
  • mkDate
t

molecule.api.Molecule

insertAsync

trait insertAsync extends AnyRef

Asynchronously insert one or more rows of data matching molecule.

Returns Future with TxReport having info about the result of the insert transaction.

Data matching the types of the molecule can be inserted either as individual args or an Iterable (List, Set etc) of tuples:

// Insert single row of data with individual args
val singleInsertFuture: Future[TxReport] = Person.name.age.insertAsync("Ann", 28)

// Insert multiple rows of data. Accepts Iterable[Tpl]
val multipleInsertFuture: Future[TxReport] = Person.name.age insertAsync List(
  ("Ben", 42),
  ("Liz", 37)
)

for {
  _ <- singleInsertFuture
  _ <- multipleInsertFuture
  result <- Person.name.age.getAsync
} yield {
  // Both inserts applied
  result === List(
    ("Ann", 28),
    ("Ben", 42),
    ("Liz", 37)
  )
}

The insert operation is asynchronous and non-blocking. Internally calls Datomic's asynchronous API.

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

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[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  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[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped