FdbPathSegment
Namespace: FoundationDB.Client · struct
Implements: IEquatable<FdbPathSegment>, IComparable<FdbPathSegment>, ISpanFormattable, IFormattable
Represent a segment in a path to a Directory.
Constructors
FdbPathSegment
FdbPathSegment(string name, string layerId = null)
Properties
IsEmpty
bool IsEmpty { get; }
Methods
CompareTo
int CompareTo(FdbPathSegment other)
Create
static FdbPathSegment Create(string name)
Return a path segment composed of only a name, but without any LayerId specified
static FdbPathSegment Create(string name, string layerId)
Return a path segment composed both a name, and a LayerId
Deconstruct
void Deconstruct(out string name, out string layerId)
Extract the pair of name and LayerId from this segment
Encode
static string Encode(string name)
static string Encode(string name, string layerId)
Equals
bool Equals(object obj)
bool Equals(FdbPathSegment other)
GetHashCode
int GetHashCode()
Parse
static FdbPathSegment[] Parse(ReadOnlySpan<string> segments)
static FdbPathSegment Parse(string value)
Parse a string representation of a path segment (name with optional LayerId)
value— Encoded path segment
Returns: Decoded path segment (may include an optional LayerId)
Parse("Foo") == FdbPathSegment.Create("Foo"); Parse("Foo[SomeLayer]") == FdbPathSegment.Create("Foo", "SomeLayer")
static FdbPathSegment Parse(ReadOnlySpan<char> value)
Parse a string representation of a path segment (name with optional LayerId)
value— Encoded path segment
Returns: Decoded path segment (may include an optional LayerId)
Parse("Foo") == FdbPathSegment.Create("Foo"); Parse("Foo[SomeLayer]") == FdbPathSegment.Create("Foo", "SomeLayer")
Partition
static FdbPathSegment Partition(string name)
Return a path segment composed a name, and the "partition" LayerId
ToString
string ToString()
Returns an encoded string representation of this path segment
Returns: Encoded string, with optional LayerId
The string returned can be parsed back into the original segment via Parse.
FdbPathSegment.Create("Foo").ToString() // => "Foo";
FdbPathSegment.Create("Foo", "SomeLayer").ToString() // => "Foo[SomeLayer]"
string ToString(string format, IFormatProvider provider = null)
Returns an encoded string representation of this path segment
format— Supported formats arenullor"D"to include layer ids, and"N"for names onlyprovider— The value is ignored
Returns: Encoded string
Supported formats: FormatResultD``"ACME[partition]"``N``"ACME"
Any string produced by this method can be passed back to Parse to get back the original path.
FdbPathSegment.Create("Hello").ToString("D") // => "Hello";
FdbPathSegment.Create("Hello", "WorldLayer").ToString("D") // => "Hello[WorldLayer]"
FdbPathSegment.Create("Hello", "WorldLayer").ToString("N") // => "Hello"
TryFormat
bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider provider = null)
TryParse
static bool TryParse(ReadOnlySpan<char> value, out FdbPathSegment segment)
Fields
Empty
static readonly FdbPathSegment Empty
Empty segment
LayerId
readonly string LayerId
Id of the layer used by the corresponding directory; or null if it is not specified
If present: when opening a directory, its LayerId will be compared to this value; when creating a directory, this value will be used as its LayerId.
Name
readonly string Name
Name of the segment
This is the equivalent of the name of the "folder"