OpsCompat
com.github.tarao.record4s.ArrayRecord.OpsCompat
final implicit class OpsCompat[R](record: ArrayRecord[R]) extends AnyVal
Attributes
- Source
- ArrayRecord.scala
- Graph
-
- Supertypes
-
class AnyValtrait Matchableclass Any
Members list
Value members
Concrete methods
inline def apply[S <: Tuple, RR <: %](s: Selector[S])(using r: RecordLike[ArrayRecord[R]], ev: Aux[R, S, RR], rr: RecordLike[RR]): ArrayRecord[TupledFieldTypes]
Create a new record by selecting some fields of an existing record.
Create a new record by selecting some fields of an existing record.
Type parameters
- RR
-
type of the new record
- S
-
list of selected field as a Tuple
Value parameters
- s
-
selection of fields created by
select
Attributes
- Returns
-
a new record with the selected fields
- Example
-
val r1 = ArrayRecord(name = "tarao", age = 3, email = "[email protected]") val r2 = r1(select.name.age) // val r2: com.github.tarao.record4s.ArrayRecord[(("name", String), ("age", Int))] = ArrayRecord(name = tarao, age = 3) val r3 = r1(select.name(rename = "nickname").age) // val r3: com.github.tarao.record4s.ArrayRecord[(("nickname", String), ("age", Int))] = ArrayRecord(nickname = tarao, age = 3)
- Source
- ArrayRecord.scala
inline def apply[U <: Tuple, RR <: %](u: Unselector[U])(using ev: Aux[R, U, RR], rr: RecordLike[RR]): ArrayRecord[Zip[ElemLabels, ElemTypes]]
Create a new record by unselecting some fields of an existing record.
Create a new record by unselecting some fields of an existing record.
Type parameters
- RR
-
type of the new record
- U
-
list of unselected field as a Tuple
Value parameters
- u
-
unselection of fields created by
unselect
Attributes
- Returns
-
a new record without the unselected fields
- Example
-
val r1 = ArrayRecord(name = "tarao", age = 3, email = "[email protected]") val r2 = r1(unselect.email) // val r2: com.github.tarao.record4s.ArrayRecord[(("name", String), ("age", Int))] = ArrayRecord(name = tarao, age = 3)
- Source
- ArrayRecord.scala
Convert this record to a To
.
Convert this record to a To
.
Type parameters
- To
-
a type to which the record is converted
Attributes
- Returns
-
a new product instance
- Example
-
case class Person(name: String, age: Int) val r = ArrayRecord(name = "tarao", age = 3) r.to[Person] // val res0: Person = Person(tarao,3)
- Source
- ArrayRecord.scala
In this article