Packages

trait GetObjs[Obj, Tpl] extends AnyRef

Data getter methods on molecules that return data as Lists of objects with attribute properties.

Attributes names are used as object property names.

Self Type
GetObjs[Obj, Tpl] with Marshalling[Obj, Tpl]
Source
GetObjs.scala
Linear Supertypes
AnyRef, Any
Type Hierarchy
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. GetObjs
  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[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 getObj(implicit conn: Future[Conn], ec: ExecutionContext): Future[Obj]

    Convenience method to get head of list of objects matching a molecule.

    Convenience method to get head of list of objects matching a molecule.

    for {
      person <- Person.name.age.getObj
      _ = person.name ==> "Ben"
      _ = person.age  ==> 42
    } yield ()
    conn

    Implicit Conn value in scope

    returns

    List[Obj] where Obj is an object with properties matching the attributes of the molecule

  11. def getObjs(n: Int)(implicit futConn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of n rows as objects matching a molecule.

    Get Future with List of n rows as objects matching a molecule.

    for {
      List(p1) <- Person.name.age.getObjs(1)
      _ = p1.name ==> "Ben"
      _ = p1.age  ==> 42
    } yield ()
    n

    Int Number of rows returned

    futConn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  12. def getObjs(implicit futConn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of all rows as objects matching a molecule.

    Get Future with List of all rows as objects matching a molecule.

    for {
      List(p1, p2) <- Person.name.age.getObjs
      _ = p1.name ==> "Ben"
      _ = p1.age  ==> 42
      _ = p2.name ==> "Liz"
      _ = p2.age  ==> 37
    } yield ()
    futConn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  13. def getObjsAsOf(date: Date, n: Int)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of n rows as objects matching a molecule as of date.

    Get Future with List of n rows as objects matching a molecule as of date.

    Get data at a human point in time (a java.util.Date).

    for {
      beforeInsert = new java.util.Date
    
      // Insert
      tx1 <- Person.name.age insert List(
        ("Ben", 42),
        ("Liz", 37)
      )
      List(ben, liz) = tx1.eids
      afterInsert = new java.util.Date
    
      // Update
      tx2 <- Person(ben).age(43).update
      afterUpdate = new java.util.Date
    
      // Get List of all rows as of afterUpdate
      List(a1, a2) <- Person.name.age.getObjsAsOf(afterUpdate)
      _ = a1.name ==> "Ben"
      _ = a1.age  ==> 43 // <-- updated
      _ = a2.name ==> "Liz"
      _ = a2.age  ==> 37
    
      // Get List of n rows as of afterUpdate
      List(b1) <- Person.name.age.getObjsAsOf(afterUpdate, 1)
      _ = b1.name ==> "Ben"
      _ = b1.age  ==> 43 // <-- updated
    } yield ()
    date

    java.util.Date

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  14. def getObjsAsOf(date: Date)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of all rows as objects matching a molecule as of date.

    Get Future with List of all rows as objects matching a molecule as of date.

    Get data at a human point in time (a java.util.Date).

    for {
      beforeInsert = new java.util.Date
    
      // Insert
      tx1 <- Person.name.age insert List(
        ("Ben", 42),
        ("Liz", 37),
      )
      List(ben, liz) = tx1.eids
      afterInsert = new java.util.Date
    
      // Update
      tx2 <- Person(ben).age(43).update
      afterUpdate = new java.util.Date
    
      // Retract
      tx3 <- ben.retract
      afterRetract = new java.util.Date
    
    
      // No data yet before insert
      _ <- Person.name.age.getObjsAsOf(beforeInsert).map(_ ==> Nil)
    
      // Get List of all rows as of afterInsert
      List(a1, a2) <- Person.name.age.getObjsAsOf(afterInsert)
      _ = a1.name ==> "Ben"
      _ = a1.age  ==> 42
      _ = a2.name ==> "Liz"
      _ = a2.age  ==> 37
    
      // Get List of all rows as of afterUpdate
      List(b1, b2) <- Person.name.age.getObjsAsOf(afterUpdate)
      _ = b1.name ==> "Ben"
      _ = b1.age  ==> 43 // <-- updated
      _ = b2.name ==> "Liz"
      _ = b2.age  ==> 37
    
      // Get List of all rows as of afterRetract
      List(c1) <- Person.name.age.getObjsAsOf(afterRetract)
      _ = c1.name ==> "Liz"
      _ = c1.age  ==> 37
    } yield ()
    date

    java.util.Date

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  15. def getObjsAsOf(tx: TxReport, n: Int)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of n rows as objects matching a molecule as of tx.

    Get Future with List of n rows as objects matching a molecule as of tx.

    Datomic's internal asOf method can take a transaction entity id as argument to retrieve a database value as of that transaction (including).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we get a TxReport from transaction operations like get, update, retract etc.

    for {
      // Insert (tx report 1)
      tx1 <- Person.name.age insert List(
        ("Ben", 42),
        ("Liz", 37)
      )
      List(ben, liz) = tx1.eids
    
      // Update (tx report 2)
      tx2 <- Person(ben).age(43).update
    
      // Get List of all rows as of tx2 (after update)
      List(a1, a2) <- Person.name.age.getObjsAsOf(tx2)
      _ = a1.name ==> "Ben"
      _ = a1.age  ==> 43 // <-- updated
      _ = a2.name ==> "Liz"
      _ = a2.age  ==> 37
    
      // Get List of n rows as of tx2 (after update)
      List(b1) <- Person.name.age.getObjsAsOf(tx2, 1)
      _ = b1.name ==> "Ben"
      _ = b1.age  ==> 43 // <-- updated
    } yield ()
    tx

    TxReport (returned from all molecule transaction operations)

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  16. def getObjsAsOf(tx: TxReport)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of all rows as objects matching a molecule as of tx.

    Get Future with List of all rows as objects matching a molecule as of tx.

    Datomic's internal asOf method can take a transaction entity id as argument to retrieve a database value as of that transaction (including).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we get a TxReport from transaction operations like get, update, retract etc.

    for {
      // Insert (tx report 1)
      tx1 <- Person.name.age insert List(
        ("Ben", 42),
        ("Liz", 37),
      )
      List(ben, liz) = tx1.eids
    
      // Update (tx report 2)
      tx2 <- Person(ben).age(43).update
    
      // Retract (tx report 3)
      tx3 = ben.retract
    
      // Get List of all rows as of tx1 (after insert)
      List(a1, a2) <- Person.name.age.getObjsAsOf(tx1)
      _ = a1.name ==> "Ben"
      _ = a1.age  ==> 42
      _ = a2.name ==> "Liz"
      _ = a2.age  ==> 37
    
      // Get List of all rows as of tx2 (after update)
      List(b1, b2) <- Person.name.age.getObjsAsOf(tx2)
      _ = b1.name ==> "Ben"
      _ = b1.age  ==> 43 // <-- updated
      _ = b2.name ==> "Liz"
      _ = b2.age  ==> 37
    
      // Get List of all rows as of tx3 (after retract)
      List(c1) <- Person.name.age.getObjsAsOf(tx3)
      _ = c1.name ==> "Liz"
      _ = c1.age  ==> 37
    } yield ()
    tx

    TxReport (returned from all molecule transaction operations)

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  17. def getObjsAsOf(t: Long, n: Int)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of n rows as objects matching a molecule as of transaction time t.

    Get Future with List of n rows as objects matching a molecule as of transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved in a getHistory call for an attribute and then be used to get data as of that point in time (including that transaction):

    for {
      // Insert (t 1028)
      List(ben, liz) <- Person.name.age insert List(
        ("Ben", 42),
        ("Liz", 37),
      ) eids
    
      // Update (t 1031)
      _ <- Person(ben).age(43).update
    
      // History of Ben
      _ <- Person(ben).age.t.op.getHistory.sortBy(r => (r._2, r._3)).map(_ ==> List(
        (42, 1028, true),  // Insert:  42 asserted
        (42, 1031, false), // Update:  42 retracted
        (43, 1031, true),  //          43 asserted
      ))
    
      // Get List of all rows as of transaction t 1031 (after update)
      List(a1, a2) <- Person.name.age.getObjsAsOf(1031)
      _ = a1.name ==> "Ben"
      _ = a1.age  ==> 43 // <-- updated
      _ = a2.name ==> "Liz"
      _ = a2.age  ==> 37
    
      // Get List of n rows as of transaction t 1031 (after update)
      List(b1) <- Person.name.age.getObjsAsOf(1031)
      _ = b1.name ==> "Ben"
      _ = b1.age  ==> 43 // <-- updated
    } yield ()
    t

    Long Transaction time t

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  18. def getObjsAsOf(t: Long)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of all rows as objects matching a molecule as of transaction time t.

    Get Future with List of all rows as objects matching a molecule as of transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved in a getHistory call for an attribute and then be used to get data as of that point in time (including that transaction):

    for {
      // Insert (t 1028)
      List(ben, liz) <- Person.name.age insert List(
        ("Ben", 42),
        ("Liz", 37),
      ) eids
    
      // Update (t 1031)
      _ <- Person(ben).age(43).update
    
      // Retract (t 1032)
      _ <- ben.retract
    
      // History of Ben
      _ <- Person(ben).age.t.op.getHistory.sortBy(r => (r._2, r._3)).map(_ ==> List(
        (42, 1028, true),  // Insert:  42 asserted
        (42, 1031, false), // Update:  42 retracted
        (43, 1031, true),  //          43 asserted
        (43, 1032, false)  // Retract: 43 retracted
      ))
    
      // Get List of data as of transaction t 1028 (after insert)
      List(a1, a2) <- Person.name.age.getObjsAsOf(1028)
      _ = a1.name ==> "Ben"
      _ = a1.age  ==> 42
      _ = a2.name ==> "Liz"
      _ = a2.age  ==> 37
    
      // Get List of data as of transaction t 1031 (after update)
      List(b1, b2) <- Person.name.age.getObjsAsOf(1031)
      _ = b1.name ==> "Ben"
      _ = b1.age  ==> 43 // <-- updated
      _ = b2.name ==> "Liz"
      _ = b2.age  ==> 37
    
      // Get List of all rows as of transaction t 1032 (after retract)
      List(c1) <- Person.name.age.getObjsAsOf(1032)
      _ = c1.name ==> "Liz"
      _ = c1.age  ==> 37
    } yield ()
    t

    Transaction time t

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  19. def getObjsHistory(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with history of operations as List on an attribute in the db.

    Get Future with history of operations as List on an attribute in the db.

    Generic datom attributes that can be called when getHistory is called:

    e - Entity id
    a - Attribute name
    v - Attribute value
    ns - Namespace name
    tx - TxReport
    t - Transaction time t
    txInstant - Transaction time as java.util.Date
    op - Operation: true (add) or false (retract)

    Example:

    for {
      // Insert (t 1028)
      List(ben, liz) <- Person.name.age insert List(
        ("Ben", 42),
        ("Liz", 37),
      ) eids
    
      // Update (t 1031)
      _ <- Person(ben).age(43).update
    
      // Retract (t 1032)
      _ <- ben.retract
    
      // History of Ben
      _ <- Person(ben).age.t.op.getObjsHistory.map(_
        .sortBy(o => (o.t, o.op))
        .map(o => "" + o.age + " " + o.t + " " + o.op) ==> List(
        "42 1028 true",  // Insert:  42 asserted
        "42 1031 false", // Update:  42 retracted
        "43 1031 true",  //          43 asserted
        "43 1032 false"  // Retract: 43 retracted
      ))
    } yield ()
    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  20. def getObjsSince(date: Date, n: Int)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of n rows as objects matching a molecule since date.

    Get Future with List of n rows as objects matching a molecule since date.

    Get data added/retracted since a human point in time (a java.util.Date).

    for {
      // Transact 3 times (`inst` retrieves transaction time/Date from tx report)
      date1 <- Person.name("Ann").save.inst
      date2 <- Person.name("Ben").save.inst
      date3 <- Person.name("Cay").save.inst
    
      // Current values
      List(a1, a2, a3) <- Person.name.getObjs
      _ = a1.name ==> "Ann"
      _ = a2.name ==> "Ben"
      _ = a3.name ==> "Cay"
    
      // Ben and Cay added since date1
      List(b1, b2) <- Person.name.getObjsSince(date1)
      _ = b1.name ==> "Ben"
      _ = b2.name ==> "Cay"
    
      // Ben and Cay added since date1 - only n (1) rows returned
      List(c1) <- Person.name.getObjsSince(date1, 1)
      _ = c1.name ==> "Ben"
    } yield ()
    date

    java.util.Date

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  21. def getObjsSince(date: Date)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of all rows as objects matching a molecule since date.

    Get Future with List of all rows as objects matching a molecule since date.

    Get data added/retracted since a human point in time (a java.util.Date).

    for {
      // Transact 3 times (`inst` retrieves transaction time/Date from tx report)
      date1 <- Person.name("Ann").save.inst
      date2 <- Person.name("Ben").save.inst
      date3 <- Person.name("Cay").save.inst
    
      // Current values
      List(a1, a2, a3) <- Person.name.getObjs
      _ = a1.name ==> "Ann"
      _ = a2.name ==> "Ben"
      _ = a3.name ==> "Cay"
    
      // Ben and Cay added since date1
      List(b1, b2) <- Person.name.getObjsSince(date1)
      _ = b1.name ==> "Ben"
      _ = b2.name ==> "Cay"
    
      // Cay added since transaction time date2
      List(c1) <- Person.name.getObjsSince(date2)
      _ = c1.name ==> "Cay"
    
      // Nothing added since transaction time date3
      _ <- Person.name.getObjsSince(date3).map(_ ==> Nil)
    } yield ()
    date

    java.util.Date

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  22. def getObjsSince(tx: TxReport, n: Int)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of n rows as objects matching a molecule since tx.

    Get Future with List of n rows as objects matching a molecule since tx.

    Datomic's internal since can take a transaction entity id as argument to retrieve a database value since that transaction (excluding the transaction itself).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we getAsyncObjList a TxReport from transaction operations like get, update, retract etc.

    for {
      // Get tx reports for 3 transactions
      tx1 <- Person.name("Ann").save
      tx2 <- Person.name("Ben").save
      tx3 <- Person.name("Cay").save
    
      // Current values
      List(a1, a2, a3) <- Person.name.getObjs
      _ = a1.name ==> "Ann"
      _ = a2.name ==> "Ben"
      _ = a3.name ==> "Cay"
    
      // Ben and Cay added since tx1
      List(b1, b2) <- Person.name.getObjsSince(tx1)
      _ = b1.name ==> "Ben"
      _ = b2.name ==> "Cay"
    
      // Ben and Cay added since tx1 - only n (1) rows returned
      List(c1) <- Person.name.getObjsSince(tx1, 1)
      _ = c1.name ==> "Ben"
    } yield ()
    tx

    TxReport

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  23. def getObjsSince(tx: TxReport)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of all rows as objects matching a molecule since tx.

    Get Future with List of all rows as objects matching a molecule since tx.

    Datomic's internal since can take a transaction entity id as argument to retrieve a database value since that transaction (excluding the transaction itself).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we getAsyncObjList a TxReport from transaction operations like get, update, retract etc.

    for {
      // Get tx reports for 3 transactions
      tx1 <- Person.name("Ann").save
      tx2 <- Person.name("Ben").save
      tx3 <- Person.name("Cay").save
    
      // Current values
      List(a1, a2, a3) <- Person.name.getObjs
      _ = a1.name ==> "Ann"
      _ = a2.name ==> "Ben"
      _ = a3.name ==> "Cay"
    
      // Ben and Cay added since transaction time tx1
      List(b1, b2) <- Person.name.getObjsSince(tx1)
      _ = b1.name ==> "Ben"
      _ = b2.name ==> "Cay"
    
      // Cay added since transaction time tx2
      List(c1) <- Person.name.getObjsSince(tx2)
      _ = c1.name ==> "Cay"
    
      // Nothing added since transaction time tx3
      _ <- Person.name.getObjsSince(tx3).map(_ ==> Nil)
    } yield ()
    tx

    TxReport

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  24. def getObjsSince(t: Long, n: Int)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of n rows as objects matching a molecule since transaction time t.

    Get Future with List of n rows as objects matching a molecule since transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved by calling t on the tx report returned from transactional operations and then be used to get data since that point in time (excluding that transaction):

    for {
      // 3 transaction times `t`
      t1 <- Person.name("Ann").save.map(_.t)
      t2 <- Person.name("Ben").save.map(_.t)
      t3 <- Person.name("Cay").save.map(_.t)
    
      // Current values
      List(a1, a2, a3) <- Person.name.getObjs
      _ = a1.name ==> "Ann"
      _ = a2.name ==> "Ben"
      _ = a3.name ==> "Cay"
    
      // Ben and Cay added since transaction time t1
      List(b1, b2) <- Person.name.getObjsSince(t1)
      _ = b1.name ==> "Ben"
      _ = b2.name ==> "Cay"
    
      // Ben and Cay added since transaction time t1 - only n (1) rows returned
      List(c1) <- Person.name.getObjsSince(t1, 1)
      _ = c1.name ==> "Ben"
    } yield ()
    t

    Transaction time t

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  25. def getObjsSince(t: Long)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of all rows as objects matching a molecule since transaction time t.

    Get Future with List of all rows as objects matching a molecule since transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved by calling t on the tx report returned from transactional operations and then be used to get data since that point in time (excluding that transaction):

    for {
      // 3 transaction times `t`
      t1 <- Person.name("Ann").save.map(_.t)
      t2 <- Person.name("Ben").save.map(_.t)
      t3 <- Person.name("Cay").save.map(_.t)
    
      // Current values
      List(a1, a2, a3) <- Person.name.getObjs
      _ = a1.name ==> "Ann"
      _ = a2.name ==> "Ben"
      _ = a3.name ==> "Cay"
    
      // Ben and Cay added since transaction time t1
      List(b1, b2) <- Person.name.getObjsSince(t1)
      _ = b1.name ==> "Ben"
      _ = b2.name ==> "Cay"
    
      // Cay added since transaction time t2
      List(c1) <- Person.name.getObjsSince(t2)
      _ = c1.name ==> "Cay"
    
      // Nothing added since transaction time t3
      _ <- Person.name.getObjsSince(t3).map(_ ==> Nil)
    } yield ()
    t

    Transaction time t

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  26. def getObjsWith(n: Int, txMolecules: Future[Seq[Statement]]*)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of n rows as objects matching a molecule with applied molecule transaction data.

    Get Future with List of n rows as objects matching a molecule with applied molecule transaction data.

    Apply one or more molecule transactions to in-memory "branch" of db without affecting db to see how it would then look:

    for {
      // Current state
      List(ben, liz) <- Person.name.likes.insert(
        ("Ben", "pasta"),
        ("Liz", "pizza")
      ).map(_.eids)
    
      List(p1, p2) <- Person.name.likes.getObjs
      _ = p1.name  ==> "Ben"
      _ = p1.likes ==> "pasta"
      _ = p2.name  ==> "Liz"
      _ = p2.likes ==> "pizza"
    
      // Test multiple transactions
      List(testP1, testP2) <- Person.name.likes.getObjsWith(
        Person(ben).likes("sushi").getUpdateStmts,
        Person(liz).likes("cake").getUpdateStmts
      )
      // Effect: sushi and cake now liked
      _ = testP1.name  ==> "Ben"
      _ = testP1.likes ==> "sushi"
      _ = testP2.name  ==> "Liz"
      _ = testP2.likes ==> "cake"
    
      // Same as above, but only n (1) rows returned:
      List(oneTestP) <- Person.name.likes.getObjsWith(
        1
        Person(ben).likes("sushi").getUpdateStmts,
        Person(liz).likes("cake").getUpdateStmts
      )
      // Effect: sushi and cake now liked (but only Ben returned)
      _ = oneTestP.name  ==> "Ben"
      _ = oneTestP.likes ==> "sushi"
    
      // Current state is still the same
      List(p3, p4) <- Person.name.likes.getObjs
      _ = p3.name  ==> "Ben"
      _ = p3.likes ==> "pasta"
      _ = p4.name  ==> "Liz"
      _ = p4.likes ==> "pizza"
    } yield ()
    n

    Int Number of rows returned

    txMolecules

    Transaction statements from applied Molecules with test data

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

    Note

    Note how the n parameter has to come before the txMolecules vararg.

  27. def getObjsWith(txMolecules: Future[Seq[Statement]]*)(implicit conn: Future[Conn], ec: ExecutionContext): Future[List[Obj]]

    Get Future with List of all rows as objects matching a molecule with applied molecule transaction data.

    Get Future with List of all rows as objects matching a molecule with applied molecule transaction data.

    Apply one or more molecule transactions to in-memory "branch" of db without affecting db to see how it would then look:

    for {
      // Current state
      ben <- Person.name("Ben").likes("pasta").save.map(_.eid)
    
      List(p0) <- Person.name.likes.getObjs
      _ = p0.name  ==> "Ben"
      _ = p0.likes ==> "pasta"
    
      // Test adding transaction data
      List(pTest) <- Person.name.likes.getObjsWith(
        // Additional transaction data
        Person(ben).likes("sushi").getUpdateStmts
      )
      // Effect: Ben would like sushi if tx was applied
      _ = pTest.name  ==> "Ben"
      _ = pTest.likes ==> "sushi"
    
      // Current state is still the same
      List(pAfter) <- Person.name.likes.getObjs
      _ = pAfter.name  ==> "Ben"
      _ = pAfter.likes ==> "pasta"
    } yield ()

    Multiple transactions can be applied to test more complex what-if scenarios!

    txMolecules

    Transaction statements from applied Molecules with test data

    conn

    Implicit Conn value in scope

    returns

    Future[List[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  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 def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  34. def toString(): String
    Definition Classes
    AnyRef → Any
  35. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

get

getAsOf

getAsync

getHistory

getSince

getWith

Ungrouped