countDistinct

molecule.boilerplate.api.KeywordsStable.countDistinct
trait countDistinct extends AggrCoalesce

Count of distinct attribute values.

Apply countDistinct keyword to attribute to return count of distinct attribute values of entities matching the molecule.

for {
 _ <- Person.firstName.lastName.age insert List(
   ("Ben", "Hayday", 42),
   ("Liz", "Taylor", 34),
   ("Liz", "Swifty", 34),
   ("Liz", "Mooray", 25)
 )
 _ <- Person.firstName.age(countDistinct).get.map(_ ==> List(
   ("Ben", 1),
   ("Liz", 2) // 34, 25
 ))
} yield ()

Attributes

Returns

Int

Source
Keywords.scala
Graph
Supertypes
trait AggrCoalesce
trait AggrKw
trait Kw
class Object
trait Matchable
class Any
Show all
Known subtypes
object countDistinct.type
In this article