sample

molecule.boilerplate.api.KeywordsStable.sample
trait sample extends AggrKw

Sample attribute value(s).

Apply sample keyword to attribute to return a single sample (random) attribute value of entities matching the molecule.

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

Apply sample(n) to return Vector of up to n distinct sample values.

Person.age(sample(3)).get.map(_.head ==> Vector(70, 25, 37)) // or other..

If values don't need to be distinct, random(n) can be used also.

Attributes

Note

Can at most return the number of values that match.

Source
Keywords.scala
Graph
Supertypes
trait AggrKw
trait Kw
class Object
trait Matchable
class Any
Known subtypes
object sample.type

Members list

Grouped members

aggregates

def apply(n: Int): samples

Distinct sample values of attribute.

Apply sample(n) to an attribute to return a Vector of up to n distinct sample values (can at most return the number of values that match).

Distinct sample values of attribute.

Apply sample(n) to an attribute to return a Vector of up to n distinct sample values (can at most return the number of values that match).

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

If values don't need to be distinct, random(n) can be used also.

Attributes

Returns

List[attribute-type]

Note

Can at most return the number of values that match.

Source
Keywords.scala