curiosity-ai / rocksdb-sharp

.net bindings for the rocksdb by facebook
BSD 2-Clause "Simplified" License
155 stars 38 forks source link

Retrieve Iterator's Key and Value as span #24

Closed devhawk closed 1 year ago

devhawk commented 2 years ago
        public unsafe static ReadOnlySpan<byte> GetValueSpan(this Iterator iterator)
        {
            IntPtr valuePtr = Native.Instance.rocksdb_iter_value(iterator.Handle, out UIntPtr valueLength);
            return new ReadOnlySpan<byte>((byte*)valuePtr, (int)valueLength);
        }