From f7e6b07acd769715358e0bc476013361674b54cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Wed, 19 Aug 2026 18:55:57 +0200 Subject: [PATCH] feat(bson): Add utility method BsonFieldWriter.write(String, BsonValueWriteable) --- bson/src/commonMain/kotlin/BsonWriter.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bson/src/commonMain/kotlin/BsonWriter.kt b/bson/src/commonMain/kotlin/BsonWriter.kt index 025aa30a..5da2dd55 100644 --- a/bson/src/commonMain/kotlin/BsonWriter.kt +++ b/bson/src/commonMain/kotlin/BsonWriter.kt @@ -274,6 +274,10 @@ private fun ByteArray.readLong(index: Int): Long { @BsonWriterDsl interface BsonFieldWriter : AnyBsonWriter { @LowLevelApi fun write(name: String, block: BsonValueWriter.() -> Unit) + @LowLevelApi + fun write(name: String, value: BsonValueWriteable) { + write(name) { value.writeTo(this) } + } @LowLevelApi fun writeBoolean(name: String, value: Boolean) @LowLevelApi fun writeDouble(name: String, value: Double) -- 2.51.2