package schema
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)
- Source
- package.scala
- 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.
Type Members
- trait GenericSchema extends AnyRef
Container for Schema object.
- trait Schema extends GenericNs
Base Schema trait with attribute types shared by all arity interfaces.
- trait Schema_0 extends Schema with OutSchema_0[Schema_0]
Schema interface to add first Schema attribute
- trait Schema_1[A] extends Schema with OutSchema_1[Schema_1, A]
Schema interface to add second Schema attribute
- trait Schema_10[A, B, C, D, E, F, G, H, I, J] extends Schema with OutSchema_10[Schema_10, A, B, C, D, E, F, G, H, I, J]
- trait Schema_11[A, B, C, D, E, F, G, H, I, J, K] extends Schema with OutSchema_11[Schema_11, A, B, C, D, E, F, G, H, I, J, K]
- trait Schema_12[A, B, C, D, E, F, G, H, I, J, K, L] extends Schema with OutSchema_12[Schema_12, A, B, C, D, E, F, G, H, I, J, K, L]
- trait Schema_13[A, B, C, D, E, F, G, H, I, J, K, L, M] extends Schema with OutSchema_13[Schema_13, A, B, C, D, E, F, G, H, I, J, K, L, M]
- trait Schema_14[A, B, C, D, E, F, G, H, I, J, K, L, M, N] extends Schema with OutSchema_14[Schema_14, A, B, C, D, E, F, G, H, I, J, K, L, M, N]
- trait Schema_15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] extends Schema with OutSchema_15[Schema_15, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O]
- trait Schema_16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] extends Schema with OutSchema_16[Schema_16, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P]
- trait Schema_17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] extends Schema with OutSchema_17[Schema_17, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q]
- trait Schema_18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] extends Schema with OutSchema_18[Schema_18, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R]
- trait Schema_19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] extends Schema with OutSchema_19[Schema_19, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S]
- trait Schema_2[A, B] extends Schema with OutSchema_2[Schema_2, A, B]
- trait Schema_20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] extends Schema with OutSchema_20[Schema_20, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T]
- trait Schema_21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] extends Schema with OutSchema_21[Schema_21, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U]
- trait Schema_22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] extends Schema with OutSchema_22[Schema_22, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V]
- trait Schema_3[A, B, C] extends Schema with OutSchema_3[Schema_3, A, B, C]
- trait Schema_4[A, B, C, D] extends Schema with OutSchema_4[Schema_4, A, B, C, D]
- trait Schema_5[A, B, C, D, E] extends Schema with OutSchema_5[Schema_5, A, B, C, D, E]
- trait Schema_6[A, B, C, D, E, F] extends Schema with OutSchema_6[Schema_6, A, B, C, D, E, F]
- trait Schema_7[A, B, C, D, E, F, G] extends Schema with OutSchema_7[Schema_7, A, B, C, D, E, F, G]
- trait Schema_8[A, B, C, D, E, F, G, H] extends Schema with OutSchema_8[Schema_8, A, B, C, D, E, F, G, H]
- trait Schema_9[A, B, C, D, E, F, G, H, I] extends Schema with OutSchema_9[Schema_9, A, B, C, D, E, F, G, H, I]
Documentation/API for the Molecule library - a meta DSL for the Datomic database.
Manual | scalamolecule.org | Github | Forum