FdbKeyRange<TLowerKey, TUpperKey>

Namespace: FoundationDB.Client · struct

Implements: IFdbKeyRange, ISpanFormattable, IFormattable, IEquatable<FdbKeyRange<TLowerKey, TUpperKey>>

Range that matches all keys between a lower and upper bound

Constructors

FdbKeyRange<TLowerKey, TUpperKey>

FdbKeyRange<TLowerKey, TUpperKey>(in TLowerKey lowerKey, KeyRangeMode lowerMode, in TUpperKey upperKey, KeyRangeMode upperMode)

Constructs a new FdbKeyRange

  • lowerKey — Key that will be used to compute the lower bound
  • lowerMode — Transformation that will be applied to lowerKey
  • upperKey — Key that will be used to compute the upper bound
  • upperMode — Transformation that will be applied to upperKey

Methods

Begin

BeginKey Begin()

Returns the inclusive "Begin" key of this range

Contains

bool Contains(Slice key)

Tests if this range contains the given key

  • key — Key that is being tested

Returns: true if the key would be matched by this range.

bool Contains(ReadOnlySpan<byte> key)

Tests if this range contains the given key

  • key — Key that is being tested

Returns: true if the key would be matched by this range.

bool Contains<TKey>(in TKey key)

Tests if this range contains the given key

  • key — Key that is being tested

Returns: true if the key would be matched by this range.

End

EndKey End()

Returns the exclusive "End" key of this range

Equals

bool Equals(FdbKeyRange<TLowerKey, TUpperKey> other)

IsAfter

bool IsAfter<TKey>(in TKey key)

Tests if the given key is strictly after this range

  • key — Key that is being tested

Returns: true if the key is greater than or equal to the effective upper bound of the range.

bool IsAfter(Slice key)

Tests if the given key is strictly after this range

  • key — Key that is being tested

Returns: true if the key is greater than or equal to the effective upper bound of the range.

IsBefore

bool IsBefore<TKey>(in TKey key)

Tests if the given key is strictly before this range

  • key — Key that is being tested

Returns: true if the key is less than the effective lower bound of the range.

bool IsBefore(Slice key)

Tests if the given key is strictly before this range

  • key — Key that is being tested

Returns: true if the key is less than the effective lower bound of the range.

Test

int Test<TKey>(in TKey key)

Tests if the key is before (-1), after (+1) or contained in the range (0)

  • key — Key that is being tested

Returns: -1 if the key is before the range, 0 if the key is in the range, and +1 if the key is after the range.

ToBeginKey

Slice ToBeginKey()

Returns the encoded Begin key (inclusive) for this range

ToBeginSelector

KeySelector ToBeginSelector()

Returns the encoded Begin key (inclusive) for this range

ToEndKey

Slice ToEndKey()

Returns the encoded End key (exclusive) for this range

ToEndSelector

KeySelector ToEndSelector()

Returns the encoded End key (exclusive) for this range

ToKeyRange

KeyRange ToKeyRange()

Encode this range into a binary KeyRange

ToString

string ToString()

string ToString(string format, IFormatProvider provider = null)

TryFormat

bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = null, IFormatProvider provider = null)

Fields

LowerKey

readonly TLowerKey LowerKey

Key that is used to compute the lower bound of this range

LowerMode

readonly KeyRangeMode LowerMode

Transformation applied to the lower key to produce the effective lower bound (Inclusive by default)

UpperKey

readonly TUpperKey UpperKey

Key that is used to compute the upper bound of this range

UpperMode

readonly KeyRangeMode UpperMode

Transformation applied to the upper key to produce the effective upper bound (Exclusive by default)