LightningDB.LightningTransaction.Delete C# (CSharp) Method

Delete() public method

Delete items from a database. This function removes key/data pairs from the database. If the database does not support sorted duplicate data items (MDB_DUPSORT) the data parameter is ignored. If the database supports sorted duplicates and the data parameter is NULL, all of the duplicate data items for the key will be deleted. Otherwise, if the data parameter is non-NULL only the matching data item will be deleted. This function will return MDB_NOTFOUND if the specified key/data pair is not in the database.
public Delete ( LightningDatabase db, byte key, byte value ) : void
db LightningDatabase A database handle returned by mdb_dbi_open()
key byte The key to delete from the database
value byte The data to delete (optional)
return void
        public void Delete(LightningDatabase db, byte[] key, byte[] value)
        {
            if (db == null)
                throw new ArgumentNullException(nameof(db));

            mdb_del(_handle, db.Handle(), key, value);
        }

Same methods

LightningTransaction::Delete ( LightningDatabase db, byte key ) : void

Usage Example

        public static void Delete <TKey, TValue>(this LightningTransaction txn, LightningDatabase db, TKey key, TValue value)
        {
            var keyBytes   = db.ToBytes(key);
            var valueBytes = db.ToBytes(value);

            txn.Delete(db, keyBytes, valueBytes);
        }
All Usage Examples Of LightningDB.LightningTransaction::Delete