-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Denys Fakhritdinov
committed
Sep 6, 2024
1 parent
1fec425
commit f26a2c0
Showing
11 changed files
with
149 additions
and
239 deletions.
There are no files selected for viewing
66 changes: 0 additions & 66 deletions
66
scassandra/src/main/scala/com/evolutiongaming/scassandra/CodecByIdx.scala
This file was deleted.
Oops, something went wrong.
66 changes: 0 additions & 66 deletions
66
scassandra/src/main/scala/com/evolutiongaming/scassandra/CodecByName.scala
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
scassandra/src/main/scala/com/evolutiongaming/scassandra/CodecRow.scala
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
scassandra/src/main/scala/com/evolutiongaming/scassandra/UpdateByIdx.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.evolutiongaming.scassandra | ||
|
||
import com.datastax.driver.core.{GettableByIndexData, SettableData} | ||
|
||
trait UpdateByIdx[-A] { | ||
|
||
def apply[D <: GettableByIndexData & SettableData[D]]( | ||
data: D, | ||
idx: Int, | ||
value: A | ||
): D | ||
|
||
} | ||
|
||
object UpdateByIdx { | ||
|
||
def apply[A: UpdateByIdx]: UpdateByIdx[A] = implicitly | ||
|
||
implicit def fromEncodeByIdx[A: EncodeByIdx]: UpdateByIdx[A] = | ||
new UpdateByIdx[A] { | ||
def apply[D <: GettableByIndexData & SettableData[D]]( | ||
data: D, | ||
idx: Int, | ||
value: A | ||
): D = EncodeByIdx[A].apply(data, idx, value) | ||
} | ||
|
||
implicit final class Syntax[A](val self: UpdateByIdx[A]) extends AnyVal { | ||
|
||
def contramap[B](f: B => A): UpdateByIdx[B] = new UpdateByIdx[B] { | ||
def apply[D <: GettableByIndexData & SettableData[D]]( | ||
data: D, | ||
idx: Int, | ||
value: B | ||
): D = self(data, idx, f(value)) | ||
} | ||
|
||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
scassandra/src/main/scala/com/evolutiongaming/scassandra/UpdateByName.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.evolutiongaming.scassandra | ||
|
||
import com.datastax.driver.core.{GettableByNameData, SettableData} | ||
|
||
trait UpdateByName[-A] { | ||
|
||
def apply[D <: GettableByNameData & SettableData[D]]( | ||
data: D, | ||
name: String, | ||
value: A | ||
): D | ||
|
||
} | ||
|
||
object UpdateByName { | ||
|
||
def apply[A: UpdateByName]: UpdateByName[A] = implicitly | ||
|
||
implicit def fromEncodeByName[A: EncodeByName]: UpdateByName[A] = | ||
new UpdateByName[A] { | ||
def apply[D <: GettableByNameData & SettableData[D]]( | ||
data: D, | ||
name: String, | ||
value: A | ||
): D = EncodeByName[A].apply(data, name, value) | ||
} | ||
|
||
implicit final class Syntax[A](val self: UpdateByName[A]) extends AnyVal { | ||
|
||
def contramap[B](f: B => A): UpdateByName[B] = new UpdateByName[B] { | ||
def apply[D <: GettableByNameData & SettableData[D]]( | ||
data: D, | ||
name: String, | ||
value: B | ||
): D = self(data, name, f(value)) | ||
} | ||
|
||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
scassandra/src/main/scala/com/evolutiongaming/scassandra/UpdateRow.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.evolutiongaming.scassandra | ||
|
||
import com.datastax.driver.core.{GettableData, SettableData} | ||
|
||
trait UpdateRow[-A] { | ||
|
||
def apply[D <: GettableData & SettableData[D]]( | ||
data: D, | ||
value: A | ||
): D | ||
|
||
} | ||
|
||
object UpdateRow { | ||
|
||
def apply[A: UpdateRow]: UpdateRow[A] = implicitly | ||
|
||
implicit def fromEncodeRow[A: EncodeRow]: UpdateRow[A] = | ||
new UpdateRow[A] { | ||
def apply[D <: GettableData & SettableData[D]]( | ||
data: D, | ||
value: A | ||
): D = EncodeRow[A].apply(data, value) | ||
} | ||
|
||
implicit final class Syntax[A](val self: UpdateRow[A]) extends AnyVal { | ||
|
||
def contramap[B](f: B => A): UpdateRow[B] = new UpdateRow[B] { | ||
def apply[D <: GettableData & SettableData[D]]( | ||
data: D, | ||
value: B | ||
): D = self(data, f(value)) | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.