Skip to content

Commit

Permalink
Made internalRun visible on MongoSession for accessing Java driver fe…
Browse files Browse the repository at this point in the history
…atures
  • Loading branch information
uberto committed Aug 22, 2024
1 parent d596f7c commit 55e1fe1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MongoDbSession(
}
}

fun <T> MongoTable<*>.internalRun(block: (MongoCollection<BsonDocument>) -> T): T =
override fun <T> MongoTable<*>.internalRun(block: (MongoCollection<BsonDocument>) -> T): T =
block(
withCollection(this)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ typealias MongoOutcome<T> = Outcome<MongoError, T>





fun <U, T> mongoCalculation(calculation: MongoSession.(U) -> T): (U) -> MongoOperation<T> = //unit
{ input: U -> MongoOperation { session -> calculation(session, input) } }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ interface MongoSession {
fun <T : Any> MongoTable<T>.drop()
fun <T : Any> MongoTable<T>.listIndexes(): Sequence<BsonDocument>


//Useful for getting access to all drivers methods
fun <T> MongoTable<*>.internalRun(block: (MongoCollection<BsonDocument>) -> T): T

companion object {
val RETURN_UPDATED = FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER)
val RETURN_BEFORE = FindOneAndUpdateOptions().returnDocument(ReturnDocument.BEFORE)
Expand Down

0 comments on commit 55e1fe1

Please sign in to comment.