Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.16]
scala: [2.13.17]
java: [temurin@17, temurin@21]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.16]
scala: [2.13.17]
java: [temurin@17]
runs-on: ${{ matrix.os }}
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ trait MacroCommons extends CompatMacroCommons { bundle =>
.collectFirst {
case (param, arg) if param.name == subSym.name => arg match {
case Literal(Constant(value: T)) => value
case Literal(Constant(null)) => whenDefault
case t if param.asTerm.isParamWithDefault && t.symbol.isSynthetic &&
t.symbol.name.decodedName.toString.contains("$default$") => whenDefault
case t if classTag[T] == classTag[Tree] => t.asInstanceOf[T]
Expand Down Expand Up @@ -1394,7 +1395,7 @@ trait MacroCommons extends CompatMacroCommons { bundle =>
// while typechecking case body and not after that. Therefore we need a macro which will inject itself exactly
// into that moment.
val fakeMatch =
q"""
q"""
import scala.language.experimental.macros
def $normName(tpref: $StringCls, value: $ScalaPkg.Any): $ScalaPkg.Any =
macro $CommonsPkg.macros.misc.WhiteMiscMacros.normalizeGadtSubtype
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ class TypedMongoClient(
def listDatabaseNames: Observable[String] =
multi(optionalizeFirstArg(nativeClient.listDatabaseNames(sessionOrNull)))

def listDatabases: Observable[Document] =
@deprecated("Use listTypedDatabases or listRawDatabases instead", "2.25.0")
def listDatabases: Observable[Nothing] = ???

def listRawDatabases: Observable[Document] =
multi(optionalizeFirstArg(nativeClient.listDatabases(sessionOrNull)))

def listDatabases[T: GenCodec]: Observable[T] =
listDatabases.map(doc => BsonValueInput.read[T](doc.toBsonDocument))
def listTypedDatabases[T: GenCodec]: Observable[T] =
listRawDatabases.map(doc => BsonValueInput.read[T](doc.toBsonDocument))

//TODO: `watch` methods

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ class TypedMongoDatabase(
def listCollectionNames: Observable[String] =
multi(optionalizeFirstArg(nativeDatabase.listCollectionNames(sessionOrNull)))

def listCollections: Observable[Document] =
@deprecated("Use listTypedCollections or listRawCollections instead", "2.25.0")
def listDatabases: Observable[Nothing] = ???

def listRawCollections: Observable[Document] =
multi(optionalizeFirstArg(nativeDatabase.listCollections(sessionOrNull)))

def listCollections[T: GenCodec]: Observable[T] =
listCollections.map(doc => BsonValueInput.read[T](doc.toBsonDocument))
def listTypedCollections[T: GenCodec]: Observable[T] =
listRawCollections.map(doc => BsonValueInput.read[T](doc.toBsonDocument))

def createCollection(
name: String,
Expand Down
2 changes: 1 addition & 1 deletion project/Commons.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object Commons extends ProjectGroup("commons") {
Developer("ddworak", "Dawid Dworak", "d.dworak@avsystem.com", url("https://github.com/ddworak")),
),

scalaVersion := "2.13.16",
scalaVersion := "2.13.17",
compileOrder := CompileOrder.Mixed,

githubWorkflowTargetTags ++= Seq("v*"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,10 @@ object ReplyDecoders {
}

val multiBulkAsXConsumerInfo: ReplyDecoder[XConsumerInfo] =
flatMultiBulkAsMap(bulkAsUTF8, undecoded).andThen(XConsumerInfo.apply)
flatMultiBulkAsMap(bulkAsUTF8, undecoded).andThen(XConsumerInfo.apply _)

val multiBulkAsXGroupInfo: ReplyDecoder[XGroupInfo] =
flatMultiBulkAsMap(bulkAsUTF8, undecoded).andThen(XGroupInfo.apply)
flatMultiBulkAsMap(bulkAsUTF8, undecoded).andThen(XGroupInfo.apply _)

def multiBulkAsXStreamInfoOf[Rec: RedisRecordCodec]: ReplyDecoder[XStreamInfo[Rec]] =
flatMultiBulkAsMap(bulkAsUTF8, undecoded).andThen(XStreamInfo[Rec](_))
Expand Down Expand Up @@ -374,7 +374,7 @@ object ReplyDecoders {
flatMultiBulkAsMap(bulkAs[A], bulkAs[B])

def flatMultiBulkAsRecord[R: RedisRecordCodec]: ReplyDecoder[R] = {
case ArrayMsg(elements: IndexedSeq[BulkStringMsg@unchecked]) if elements.forall(_.isInstanceOf[BulkStringMsg]) =>
case ArrayMsg(elements: IndexedSeq[BulkStringMsg @unchecked]) if elements.forall(_.isInstanceOf[BulkStringMsg]) =>
RedisRecordCodec[R].read(elements)
}

Expand Down
Loading