Object/Trait

datomiscadao

DB

Related Docs: trait DB | package datomiscadao

Permalink

object DB

Object abstraction with for interacting with Datomic. Note that this object, is not intended to try and abstract/hide away the fact that we are using Datomic, but rather intends to make it easier to use Datomic the way that we want to use it in this app.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. DB
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. class EntityGetter[T] extends AnyRef

    Permalink

    Little bit of boilerplate to get around the fact that Scala type parameter inference is either all or nothing.

    Little bit of boilerplate to get around the fact that Scala type parameter inference is either all or nothing. See http://stackoverflow.com/questions/10726222/simulate-partial-type-parameter-inference-with-implicits/10734268#10734268 for an explaination of why this is necessary and the sample from which this code is derived from.

    T

    the return type

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def add[DD <: AnyRef, Card <: Cardinality, A, I](id: I)(attrVal: (Attribute[DD, Card], A))(implicit conn: Connection, ec: ExecutionContext, ev1: AsEntityId[I], ev2: Attribute2FactWriter[DD, Card, A]): Future[TxReport]

    Permalink

    Asserts a new fact in the database

    Asserts a new fact in the database

    DD

    the Datomic Data type

    Card

    the cardinality of the attribute

    A

    the type of the value that you are adding

    id

    the entity ID

    attrVal

    the assertion of the form Schema.thing -> value

    conn

    the database connection

    ec

    the execution context

    ev2

    the Attribute2FactWriter

    returns

    the database result

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def factOrNone[T, DD <: AnyRef, Card <: Cardinality, A](original: Any, changed: Any, attrVal: (Attribute[DD, Card], A))(implicit ev2: Attribute2FactWriter[DD, Card, A], id: Long): Option[TxData]

    Permalink
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def get[T]: EntityGetter[T]

    Permalink

    See EntityGetter.apply().

    See EntityGetter.apply().

    T

    the type that you want returned

    returns

    the EntityGetter

  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def hasAttribute(attributeIdent: Keyword)(implicit db: Database, conn: Connection): Boolean

    Permalink
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  15. def headOption[T](query: Iterable[Any], db: Database)(implicit reader: EntityReader[T]): Option[T]

    Permalink

    Returns a single entity (the first entity if there are many that match the query) as an option or None if there are no results matching the query

    Returns a single entity (the first entity if there are many that match the query) as an option or None if there are no results matching the query

    query

    the executed query

    db

    the database - Required to convert the entity ID to the full entity. For consistency, This should be the same database that you used to execute the query.

    reader

    the reader to convert to the specified entity type

    returns

    Some(entity) of there is at lease one result where entity is the first entity found, or None if there are no results

  16. def headOptionWithId[T](query: Iterable[Any], db: Database)(implicit reader: EntityReader[T]): Option[(Long, T)]

    Permalink
  17. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  18. def list[T](query: Iterable[Any], db: Database)(implicit reader: EntityReader[T]): List[T]

    Permalink

    Returns the list of entities chosen by the query tupled with its ID.

    Returns the list of entities chosen by the query tupled with its ID.

    query

    the Datomic Query

    db

    the database - Required to convert the entity ID to the full entity. For consistency, This should be the same database that you used to execute the query.

    reader

    the reader for the entity

  19. def listToPage[T](rawList: List[Any], filter: PageFilter)(implicit db: Database, reader: EntityReader[T]): Page[T]

    Permalink
  20. def listWithId[T](query: Iterable[Any], db: Database)(implicit reader: EntityReader[T]): List[(Long, T)]

    Permalink
  21. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. def page[T](query: Iterable[Any], filter: PageFilter)(implicit db: Database, reader: EntityReader[T]): Page[T]

    Permalink

    Runs a query and pulls a single page worth of values out.

    Runs a query and pulls a single page worth of values out.

    query

    the query

    filter

    the filter

    db

    the database - Required to convert the entity ID to the full entity. For consistency, This should be the same database that you used to execute the query.

    reader

    the entity reader

    returns

    the Page

    Attributes
    protected
  25. def pageWithId[T](query: Iterable[Any], filter: PageFilter)(implicit db: Database, reader: EntityReader[T]): Page[(Long, T)]

    Permalink
    Attributes
    protected
  26. def pageWithSort[T](query: Iterable[(Any, Any)], filter: PageFilter, sort: SortOrder = Asc)(implicit db: Database, reader: EntityReader[T]): Page[T]

    Permalink
    Attributes
    protected
  27. def retract[I, DD <: AnyRef, Card <: Cardinality, T](id: I, attr: Attribute[DD, Card])(implicit conn: Connection, ec: ExecutionContext, attrC: Attribute2EntityReaderInj[DD, Card, T], ev2: Attribute2FactWriter[DD, Card, T], idConv: AsPermanentEntityId[I]): Future[Unit]

    Permalink

    Retract an individual attribute for a given entity.

    Retract an individual attribute for a given entity. Before issuing the retraction, it first checks that there is a value there to retract. If there is not, this method is simply a NOOP.

    I

    the type of the ID

    DD

    the Datomic Data type

    Card

    the cardinality of the attribute

    T

    the type of the value that you are retracting

    id

    the identified for the entity. Can either be an ID, or a lookup ref

    attr

    the attribute to retract

    conn

    the database connection

    ec

    the ExecutionContext

    attrC

    the Attribute2EntityReaderInj

    ev2

    the Attribute2FactWriter

    idConv

    the ID converter

    returns

    a successful future if all goes well

  28. def retractEntity[I](id: I)(implicit conn: Connection, ex: ExecutionContext, idConv: AsPermanentEntityId[I]): Future[TxReport]

    Permalink

    This is the Datomic equivalent of a delete, except in Datomic, nothing ever gets deleted.

    This is the Datomic equivalent of a delete, except in Datomic, nothing ever gets deleted. You can only insert a retraction, that flags the specified entity as ignored.

    I

    the type of the ID, can either be a Long or a LookupRef

    id

    the ID of the entity to retract

    ex

    the ExecutionContext

    returns

    the transaction record specifying whether or not the transaction succeeded or failed

  29. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  30. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  31. def transactAndWait(facts: TraversableOnce[TxData], resolveId: DId)(implicit conn: Connection): Long

    Permalink
  32. def transactAndWait(facts: TraversableOnce[TxData])(implicit conn: Connection): Unit

    Permalink
  33. def transactAndWait(facts: TxData*)(implicit conn: Connection): Unit

    Permalink
  34. def uuid: UUID

    Permalink

    Generate a unique UUID to be used as a lookup-ref.

    Generate a unique UUID to be used as a lookup-ref. Abstracting away the fact that we are using Datomic to generate UUIDs. We are using Datomic for reasons specified here: http://docs.datomic.com/identity.html

    returns

    the UUID

  35. def value[I, DD <: AnyRef, Card <: Cardinality, T](id: I, attribute: Attribute[DD, Card], db: Database)(implicit attrC: Attribute2EntityReaderInj[DD, Card, T], idConv: AsPermanentEntityId[I]): T

    Permalink

    Retrieves the value of a particular field for a particular entity.

    Retrieves the value of a particular field for a particular entity. In other words, in the EAVT structure of Datomic this method allows you to specify the id (E), attribute (A), and what you will get in return is the most recent (T) value (V).

    DD

    the Datomic Data type

    Card

    the cardinality

    T

    the return type (must correspond to the Datomic data type)

    id

    the ID of the entity that you want to query

    attribute

    the schema attribute of the field that you want to get

    db

    the database

    attrC

    the converter

    returns

    the field value

  36. def valueOpt[I, DD <: AnyRef, Card <: Cardinality, T](id: I, attribute: Attribute[DD, Card], database: Database)(implicit attrC: Attribute2EntityReaderInj[DD, Card, T], idConv: AsPermanentEntityId[I]): Option[T]

    Permalink

    Retrieves the optional value of a particular attribute for a particular entity, from a particular database value.

    Retrieves the optional value of a particular attribute for a particular entity, from a particular database value. In other words, in the EAVT structure of Datomic this method allows you to specify the id (E), attribute (A), and what you will get in return is the most recent (T) value (V), for the supplied database.

    DD

    the Datomic Data type

    Card

    the cardinality

    T

    the return type (must correspond to the Datomic data type)

    id

    the ID of the entity that you want to query

    attribute

    the schema attribute of the field that you want to get

    database

    the database

    attrC

    the converter

    returns

    the field value

  37. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped