Composite
Attributes
- Source
- Composite.scala
- Graph
-
- Supertypes
- Self type
-
Composite.type
Members list
Value members
Concrete methods
Allows you to define a composite type that is composed of other SQLDefinitions.
Allows you to define a composite type that is composed of other SQLDefinitions.
For example you can compose multiple Columns:
case class Person(name: String, age: Int)
val nameCol = Column[String]("name")
val ageCol = Column[Int]("age")
val person: SQLDefinition[Person] =
Composite((nameCol.sqlDef, ageCol.sqlDef))(Person.apply)(Tuple.fromProductTyped)
// or alternatively
val person: SQLDefinition[Person] =
Composite((nameCol, ageCol).toSqlResults)(Person.apply)(Tuple.fromProductTyped)
Or even other Composites:
val pet1Col = Column[String]("pet1")
val pet2Col = Column[String]("pet2")
case class Pets(pet1: String, pet2: String)
val pets: SQLDefinition[Pets] = Composite((pet1Col.sqlDef, pet2Col.sqlDef))(Pets.apply)(Tuple.fromProductTyped)
case class PersonWithPets(person: Person, pets: Pets)
val personWithPets: SQLDefinition[PersonWithPets] =
Composite((person, pets))(PersonWithPets.apply)(Tuple.fromProductTyped)
Value parameters
- map
-
Function to map the tuple of components to the final result
- sqlDefinitionsTuple
-
Tuple of SQLDefinitions to compose
- unmap
-
Function to map the final result to the tuple of components
Attributes
- Source
- Composite.scala
Overload for a single element tuple.
SQLDefinition when the element is defined by two Optional values.
SQLDefinition when the element is defined by two Optional values.
Usually the database constraints will enforce that both are either Some or None.
Attributes
- Source
- Composite.scala
SQLDefinition when the element is defined by three Optional values.
SQLDefinition when the element is defined by three Optional values.
Usually the database constraints will enforce that both are either Some or None.
Attributes
- Source
- Composite.scala
SQLDefinition when the element is defined by four Optional values.
SQLDefinition when the element is defined by four Optional values.
Usually the database constraints will enforce that both are either Some or None.
Attributes
- Source
- Composite.scala
SQLDefinition when the element is defined by five Optional values.
SQLDefinition when the element is defined by five Optional values.
Usually the database constraints will enforce that both are either Some or None.
Attributes
- Source
- Composite.scala
SQLDefinition when the element is defined by six Optional values.
SQLDefinition when the element is defined by six Optional values.
Usually the database constraints will enforce that both are either Some or None.
Attributes
- Source
- Composite.scala
SQLDefinition when the element is defined by seven Optional values.
SQLDefinition when the element is defined by seven Optional values.
Usually the database constraints will enforce that both are either Some or None.
Attributes
- Source
- Composite.scala