IFdbKey

Namespace: FoundationDB.Client · interface

Implements: ISpanEncodable, ISpanFormattable, IFormattable, IEquatable<FdbRawKey>, IComparable<FdbRawKey>, IEquatable<Slice>, IComparable<Slice>, IEquatable<IFdbKey>, IComparable, IEquatable<ReadOnlySpan<byte>>, IComparable<ReadOnlySpan<byte>>

Represents a key in the database, that can be serialized into bytes

Remarks

Types that implement this interface usually wrap a parent subspace, as well as the elements that make up a key inside this subspace.

For example, a FdbTupleKey will wrap the items ("hello", 123), which will be later converted into bytes using the Tuple Encoding

Keys that are reused multiple times can be converted into a FdbRawKey using the Memoize method, which wraps the complete key in a Slice.

Properties

IsNull

bool IsNull { get; }

Tests if the key is Nil

Methods

Contains

bool Contains(ReadOnlySpan<byte> key)

Tests if this key is a prefix of the given key

  • key — Key being tested

Returns: true if key starts with the same bytes as the current key; otherwise, false

The key foobar is contained inside foo because it starts with foo, but bar is NOT contained inside foo because it does not have the same prefix.

Any key contains "itself", so foo is contained inside foo

bool Contains<TOtherKey>(in TOtherKey key)

Tests if this key is a prefix of the given key

  • key — Key being tested

Returns: true if key starts with the same bytes as the current key; otherwise, false

The key foobar is contained inside foo because it starts with foo, but bar is NOT contained inside foo because it does not have the same prefix.

Any key contains "itself", so foo is contained inside foo

FastCompareTo

int FastCompareTo<TOtherKey>(in TOtherKey key)

FastEqualTo

bool FastEqualTo<TOtherKey>(in TOtherKey key)

GetSubspace

IKeySubspace GetSubspace()

Optional subspace that contains this key

If null, this is most probably a key that as already been encoded.