Packages

  • package root
    Definition Classes
    root
  • package molecule
    Definition Classes
    root
  • package boilerplate
    Definition Classes
    molecule
  • package api
    Definition Classes
    boilerplate
  • trait KeywordsStable extends AnyRef

    Keywords to mark aggregate expressions on and unifications of attributes.

    Keywords to mark aggregate expressions on and unifications of attributes.

    // Aggregates on any attribute type
    Person.age(count).get.map(_.head ==> 3)         // count of asserted `age` attribute values
    Person.age(countDistinct).get.map(_.head ==> 3) // count of asserted distinct `age` attribute values
    Person.age(max).get.map(_.head ==> 38)          // maximum `age` value (using `compare`)
    Person.age(min).get.map(_.head ==> 5)           // maximum `age` value (using `compare`)
    Person.age(rand).get.map(_.head ==> 25)         // single random `age` value
    Person.age(sample).get.map(_.head ==> 27)       // single sample `age` value (when single value, same as random)
    
    // Aggregates on any attribute type, returning multiple values
    Person.age(distinct).get.map(_.head ==> Vector(5, 7, 38)) // distinct `age` values
    Person.age(max(2)).get.map(_.head ==> Vector(38, 7))      // 2 maximum `age` values
    Person.age(min(2)).get.map(_.head ==> Vector(5, 7))       // 2 minimum `age` values
    Person.age(rand(2)).get.map(_.head ==> Stream(5, ?))      // 2 random `age` values (values can re-occur)
    Person.age(sample(2)).get.map(_.head ==> Vector(7, 38))   // 2 sample `age` values
    
    // Aggregates on number attributes
    Person.age(sum).get.map(_.head ==> 50)                  // sum of all `age` numbers
    Person.age(avg).get.map(_.head ==> 16.66666667)         // average of all `age` numbers
    Person.age(median).get.map(_.head ==> 7)                // median of all `age` numbers
    Person.age(stddev).get.map(_.head ==> 15.107025591499)  // standard deviation of all `age` numbers
    Person.age(variance).get.map(_.head ==> 228.2222222222) // variance of all `age` numbers
    Definition Classes
    api
  • AggrCoalesce
  • AggrInt
  • AggrKw
  • Kw
  • avg
  • bi
  • count
  • countDistinct
  • distinct
  • max
  • maxs
  • median
  • min
  • mins
  • rand
  • rands
  • sample
  • samples
  • stddev
  • sum
  • unify
  • v1
  • variance

trait rand extends AggrKw

Random attribute value(s).

Apply random keyword to attribute to return a single random attribute of entities matching the molecule.

for {
  _ <- Person.age.insert(25, 34, 37, 42, 70)
  _ <- Person.age(random).get.map(_.head ==> 34) // or other..
} yield ()

Apply random(n) to return Vector of n random values. Observe though that duplicate random values can re-occur.

Person.age(random(3)).get.map(_.head ==> Vector(42, 25, 42)) // or other..

To get distinct values only, use the sample(n) keyword instead.

Source
Keywords.scala
Linear Supertypes
AggrKw, Kw, AnyRef, Any
Known Subclasses
Type Hierarchy
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. rand
  2. AggrKw
  3. Kw
  4. AnyRef
  5. 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. def apply(n: Int): rands

    Random values of attribute.

    Random values of attribute.

    Apply a number n to random to return Stream of n random attribute values of from entities matching the molecule.
    Observe that duplicate random values can re-occur.

    for {
      _ <- Person.age.insert(25, 34, 37, 42, 70)
      _ <- Person.age(random(3)).get.map(_.head ==> Stream(42, 25, 42)) // or other..
    } yield ()

    To get distinct values only, use the sample(n) keyword instead.

    returns

    List[attribute-type]

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @IntrinsicCandidate()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  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() @IntrinsicCandidate()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  15. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from AggrKw

Inherited from Kw

Inherited from AnyRef

Inherited from Any

Aggregate keywords

Keywords applied to attributes that return aggregated value(s).

Ungrouped