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

    Generic Schema attribute interfaces of all arities.

    Generic Schema attribute interfaces of all arities.

    The generic Schema interface provides attributes to build molecules that query the Schema structure of the current database.

    // List of attribute entity ids
    val attrIds: Seq[Long] = Schema.id.get
    
    // Attribute name elements
    Schema.a.part.ns.nsFull.attr.get === List (
      (":sales_Customer/name", "sales", "Customer", "sales_Customer", "name"),
      (":sales_Customer/name", "sales", "Customer", "sales_Customer", "name"),
      // etc..
    )
    
    // Datomic type and cardinality of attributes
    Schema.a.tpe.card.get === List (
      (":sales_Customer/name", "string", "one"),
      (":accounting_Invoice/invoiceLine", "ref", "many"),
    )
    
    // Optional docs and attribute options
    // These can be retrieved as mandatory or optional values
    Schema.a
          .index
          .doc$
          .unique$
          .fulltext$
          .isComponent$
          .noHistory$
          .get === List(
      (":sales_Customer/name",
        true,            // indexed
        "Customer name", // doc
        None,            // Uniqueness not set
        Some(true),      // Fulltext search set so that we can search for names
        None,            // Not a component
        None             // History is preserved (noHistory not set)
        ),
      (":accounting_Invoice/invoiceLine",
        true,                   // indexed
        "Ref to Invoice lines", // doc
        None,                   // Uniqueness not set
        None,                   // Fulltext search not set
        Some(true),             // Invoice is a component - owns invoice lines
        None                    // History is preserved (noHistory not set)
        ),
    )
    
    // Defined enum values
    Schema.a.enum.get.groupBy(_._1).map(g => g._1 -> g._2) === Map(
      ":Person/gender" -> List("female", "male"),
      ":Interests/sports" -> List("golf", "basket", "badminton")
    )
    
    // Schema transaction times
    Schema.t.tx.txInstant.get === List(
      (t1, tx1, <Date: 2018-11-07 09:28:10>), // Initial schema transaction
      (t2, tx2, <Date: 2019-01-12 12:43:27>), // Additional schema attribute definitions...
    )

    Apply expressions to narrow the returned selection of Schema data:

    // Namespaces in the "gen" partition (partition name tacit)
    Schema.part_("location").ns.get === List("Country", "Region", etc...)
    
    // Attributes in the "Person" namespace
    Schema.ns_("Person").attr.get === List("name", "age", "hobbies", etc...)
    
    // How many enum attributes?
    Schema.enum_.a(count).get === List(2)
    Definition Classes
    generic
    Note

    Schema attributes defined in Datomic's bootstrap process that are not related to the current database are transparently filtered out from all Schema queries.

    See also

    Tests for more Schema query examples.

  • GenericSchema
  • Schema
  • Schema_0
  • Schema_1
  • Schema_10
  • Schema_11
  • Schema_12
  • Schema_13
  • Schema_14
  • Schema_15
  • Schema_16
  • Schema_17
  • Schema_18
  • Schema_19
  • Schema_2
  • Schema_20
  • Schema_21
  • Schema_22
  • Schema_3
  • Schema_4
  • Schema_5
  • Schema_6
  • Schema_7
  • Schema_8
  • Schema_9

trait Schema_0 extends Schema with OutSchema_0[Schema_0]

Schema interface to add first Schema attribute

Source
Schema_0.scala
Linear Supertypes
OutSchema_0[Schema_0], AggregateSchema00[Schema_0], NS00[Nothing], NS, Schema, GenericNs, AnyRef, Any
Known Subclasses
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Schema_0
  2. OutSchema_0
  3. AggregateSchema00
  4. NS00
  5. NS
  6. Schema
  7. GenericNs
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. final class a[Ns, In] extends OneString[Ns, In] with Indexed

    (Partition-)Namespace-prefixed attribute name (":part_Ns/attr" or ":Ns/attr" if no partitions).

    (Partition-)Namespace-prefixed attribute name (":part_Ns/attr" or ":Ns/attr" if no partitions).

    Definition Classes
    Schema
  2. final class attr[Ns, In] extends OneString[Ns, In] with Indexed

    Isolated attribute name without namespace prefix ("attr").

    Isolated attribute name without namespace prefix ("attr").

    Definition Classes
    Schema
  3. final class card[Ns, In] extends OneString[Ns, In] with Indexed

    Cardinality: one/many.

    Cardinality: one/many.

    Definition Classes
    Schema
  4. final class doc[Ns, In] extends OneString[Ns, In] with Indexed with Fulltext[Ns, In]

    Documentation string.

    Documentation string.

    Definition Classes
    Schema
  5. final class doc$[Ns, In] extends OneString$[Ns] with Indexed with Fulltext[Ns, In]

    Optional documentation string.

    Optional documentation string.

    Definition Classes
    Schema
  6. final class enum[Ns, In] extends OneString[Ns, In] with Indexed

    Enum attributes.

    Enum attributes.

    Definition Classes
    Schema
  7. final class fulltext[Ns, In] extends OneBoolean[Ns, In] with Indexed

    Attribute fulltext search status (true/not set).

    Attribute fulltext search status (true/not set).

    Definition Classes
    Schema
  8. final class fulltext$[Ns, In] extends OneBoolean$[Ns] with Indexed

    Optional attribute fulltext search status (true/not set).

    Optional attribute fulltext search status (true/not set).

    Definition Classes
    Schema
  9. final class id[Ns, In] extends OneLong[Ns, In] with Indexed

    Attribute definition entity id.

    Attribute definition entity id.

    Definition Classes
    Schema
  10. final class index[Ns, In] extends OneBoolean[Ns, In] with Indexed

    Attribute index status (true/not set).

    Attribute index status (true/not set).

    Definition Classes
    Schema
  11. final class index$[Ns, In] extends OneBoolean$[Ns] with Indexed

    Optional attribute index status (true/not set).

    Optional attribute index status (true/not set).

    Definition Classes
    Schema
  12. final class isComponent[Ns, In] extends OneBoolean[Ns, In] with Indexed

    Attribute isComponent status (true/not set).

    Attribute isComponent status (true/not set).

    Definition Classes
    Schema
  13. final class isComponent$[Ns, In] extends OneBoolean$[Ns] with Indexed

    Optional attribute isComponent status (true/not set).

    Optional attribute isComponent status (true/not set).

    Definition Classes
    Schema
  14. final class noHistory[Ns, In] extends OneBoolean[Ns, In] with Indexed

    Attribute noHistory status (true/not set).

    Attribute noHistory status (true/not set).

    Definition Classes
    Schema
  15. final class noHistory$[Ns, In] extends OneBoolean$[Ns] with Indexed

    Optional attribute noHistory status (true/not set).

    Optional attribute noHistory status (true/not set).

    Definition Classes
    Schema
  16. final class ns[Ns, In] extends OneString[Ns, In] with Indexed

    Namespace name ("ns").

    Namespace name ("ns").

    Definition Classes
    Schema
  17. final class nsFull[Ns, In] extends OneString[Ns, In] with Indexed

    Namespace name with partition prefix ("part_Ns" or simply "ns" if partitions are not defined).

    Namespace name with partition prefix ("part_Ns" or simply "ns" if partitions are not defined).

    Definition Classes
    Schema
  18. final class part[Ns, In] extends OneString[Ns, In] with Indexed

    Partition name (if partitions are not defined it will be an empty string "").

    Partition name (if partitions are not defined it will be an empty string "").

    Definition Classes
    Schema
  19. final class t[Ns, In] extends OneLong[Ns, In] with Indexed

    Attribute definition transaction point in time.

    Attribute definition transaction point in time.

    Definition Classes
    Schema
  20. final class tpe[Ns, In] extends OneString[Ns, In] with Indexed

    Datomic attribute type.

    Datomic attribute type.

    Some Datomic types map to two Scala types:

    Datomic/Scala types:

    • string - String
    • boolean - Boolean
    • long - Int, Long
    • float - Float
    • double - Double
    • bigint - BigInt
    • bigdec - BigDecimal
    • instant - java.util.Date
    • uuid - java.util.UUID
    • uri - java.net.URI
    • ref - Long
    Definition Classes
    Schema
  21. final class tx[Ns, In] extends OneLong[Ns, In] with Indexed

    Attribute definition transaction entity id.

    Attribute definition transaction entity id.

    Definition Classes
    Schema
  22. final class txInstant[Ns, In] extends OneDate[Ns, In] with Indexed

    Attribute definition transaction wall-clock time.

    Attribute definition transaction wall-clock time.

    Definition Classes
    Schema
  23. final class unique[Ns, In] extends OneString[Ns, In] with Indexed

    Attribute uniqueness status (true/not set).

    Attribute uniqueness status (true/not set).

    Definition Classes
    Schema
  24. final class unique$[Ns, In] extends OneString$[Ns] with Indexed

    Optional attribute uniqueness status (true/not set).

    Optional attribute uniqueness status (true/not set).

    Definition Classes
    Schema
  25. type Next[Attr[_, _], Type] = Attr[Schema_1[Type], P2[_, _]] with Schema_1[Type]
  26. type Stay[Attr[_, _], Type] = Attr[Schema_0, P1[_]] with Schema_0

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 lazy val a: Next[a, String]
  5. final lazy val a_: Stay[a, String]
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. final lazy val attr: Next[attr, String]
  8. final lazy val attr_: Stay[attr, String]
  9. final lazy val card: Next[card, String]
  10. final lazy val card_: Stay[card, String]
  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  12. final lazy val doc: Next[doc, String]
  13. final lazy val doc$: Next[doc$, Option[String]]
  14. final lazy val doc_: Stay[doc, String]
  15. final lazy val enum: Next[enum, String]
  16. final lazy val enum_: Stay[enum, String]
  17. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  19. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  20. final lazy val fulltext: Next[fulltext, Boolean]
  21. final lazy val fulltext$: Next[fulltext$, Option[Boolean]]
  22. final lazy val fulltext_: Stay[fulltext, Boolean]
  23. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  24. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. final lazy val id: Next[id, Long]
  26. final lazy val id_: Stay[id, Long]
  27. final lazy val index: Next[index, Boolean]
  28. final lazy val index$: Next[index$, Option[Boolean]]
  29. final lazy val index_: Stay[index, Boolean]
  30. final lazy val isComponent: Next[isComponent, Boolean]
  31. final lazy val isComponent$: Next[isComponent$, Option[Boolean]]
  32. final lazy val isComponent_: Stay[isComponent, Boolean]
  33. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  34. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  35. final lazy val noHistory: Next[noHistory, Boolean]
  36. final lazy val noHistory$: Next[noHistory$, Option[Boolean]]
  37. final lazy val noHistory_: Stay[noHistory, Boolean]
  38. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  39. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  40. final lazy val ns: Next[ns, String]
  41. final lazy val nsFull: Next[nsFull, String]
  42. final lazy val nsFull_: Stay[nsFull, String]
  43. final lazy val ns_: Stay[ns, String]
  44. final lazy val part: Next[part, String]
  45. final lazy val part_: Stay[part, String]
  46. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  47. final lazy val t: Next[t, Long]
  48. final lazy val t_: Stay[t, Long]
  49. def toString(): String
    Definition Classes
    AnyRef → Any
  50. final lazy val tpe: Next[tpe, String]
  51. final lazy val tpe_: Stay[tpe, String]
  52. final lazy val tx: Next[tx, Long]
  53. final lazy val txInstant: Next[txInstant, Date]
  54. final lazy val txInstant_: Stay[txInstant, Date]
  55. final lazy val tx_: Stay[tx, Long]
  56. final lazy val unique: Next[unique, String]
  57. final lazy val unique$: Next[unique$, Option[String]]
  58. final lazy val unique_: Stay[unique, String]
  59. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  60. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  61. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from OutSchema_0[Schema_0]

Inherited from AggregateSchema00[Schema_0]

Inherited from NS00[Nothing]

Inherited from NS

Inherited from Schema

Inherited from GenericNs

Inherited from AnyRef

Inherited from Any

Ungrouped