diff --git a/src/LightningDB/LightningCursor.cs b/src/LightningDB/LightningCursor.cs
index 20cd388..ee8d4ed 100644
--- a/src/LightningDB/LightningCursor.cs
+++ b/src/LightningDB/LightningCursor.cs
@@ -1,7 +1,7 @@
-using System;
+using System;
using System.Buffers;
using System.Runtime.CompilerServices;
-
+using System.Runtime.InteropServices;
using static LightningDB.Native.Lmdb;
namespace LightningDB;
@@ -444,6 +444,35 @@ int GetSize()
}
}
+ ///
+ /// Store by cursor.
+ /// This function stores key/data pairs into the database.
+ /// If the function fails for any reason, the state of the cursor will be unchanged.
+ /// If the function succeeds and an item is inserted into the database, the cursor is always positioned to refer to the newly inserted item.
+ ///
+ /// The key operated on.
+ /// The data items operated on.
+ /// Returns
+ public unsafe MDBResultCode PutMultiple(ReadOnlySpan key, ReadOnlySpan values)
+ where T : unmanaged
+ {
+ var valuesBytes = MemoryMarshal.AsBytes(values);
+
+ fixed (byte* keyPtr = key)
+ fixed (byte* valuesPtr = valuesBytes)
+ {
+ var mdbKey = new MDBValue(key.Length, keyPtr);
+
+ Span dataBuffer =
+ [
+ new (Unsafe.SizeOf(), valuesPtr),
+ new (values.Length, null)
+ ];
+
+ return mdb_cursor_put(_handle, ref mdbKey, ref dataBuffer[0], CursorPutOptions.MultipleData);
+ }
+ }
+
///
/// Return up to a page of the duplicate data items at the current cursor position. Only for MDB_DUPFIXED
/// It is assumed you know the array size to break up a single byte[] into byte[][].