PgBox
Namespace: Ankus
Assembly: Ankus.Runtime.dll
An axis-aligned PostgreSQL box with normalized high and low corners. NaN sorts above finite values and infinity. Equality compares corners exactly rather than using PostgreSQL’s area-based equality operator.
public readonly struct PgBox : ISpanFormattable, IFormattable, IParsable<PgBox>, IEquatable<PgBox>Implements: ISpanFormattable, IFormattable, IParsable<PgBox>, IEquatable<PgBox>
Constructors
Section titled “Constructors”PgBox(PgPoint, PgPoint)
Section titled “PgBox(PgPoint, PgPoint)”Normalizes two corners using PostgreSQL floating-point ordering, preserving equal-coordinate bit patterns.
public PgBox(PgPoint first, PgPoint second)Parameters:
first — PgPoint
The first corner, used as the high corner when coordinates compare equal.
second — PgPoint
The second corner.
Methods
Section titled “Methods”Equals(PgBox)
Section titled “Equals(PgBox)”public bool Equals(PgBox other)Parameters:
other — PgBox
Returns: bool
Equals(object)
Section titled “Equals(object)”public override bool Equals(object obj)Parameters:
obj — object
Returns: bool
GetHashCode()
Section titled “GetHashCode()”public override int GetHashCode()Returns: int
Parse(string)
Section titled “Parse(string)”Parses a box using PostgreSQL on the active backend.
public static PgBox Parse(string text)Parameters:
text — string
The box text.
Returns: PgBox
The normalized box.
ToString()
Section titled “ToString()”Formats normalized corners without backend access.
public override string ToString()Returns: string
The box text.
ToString(string?, IFormatProvider?)
Section titled “ToString(string?, IFormatProvider?)”Formats the value as PostgreSQL’s canonical text, the same text as ToString().
public string ToString(string? format, IFormatProvider? formatProvider)Parameters:
format — string
Null or empty; PostgreSQL text has one canonical form.
formatProvider — IFormatProvider
Ignored: the text does not depend on culture.
Returns: string
The canonical text.
Exceptions:
- FormatException: A format is specified.
TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)
Section titled “TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)”Copies the value’s canonical PostgreSQL text into a span, as interpolated strings and other span-based formatters request it.
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)Parameters:
destination — Span<char>
The span that receives the text.
charsWritten — int
The number of characters written.
format — ReadOnlySpan<char>
Empty; PostgreSQL text has one canonical form.
provider — IFormatProvider
Ignored: the text does not depend on culture.
Returns: bool
Whether the text fit in the destination.
Exceptions:
- FormatException: A format is specified.
TryParse(string?, out PgBox)
Section titled “TryParse(string?, out PgBox)”Tries PostgreSQL parsing without swallowing backend-access or operational errors.
public static bool TryParse(string? text, out PgBox value)Parameters:
text — string
The box text.
value — PgBox
The result, or default.
Returns: bool
Whether parsing succeeded.
Invalid input leaves no error pending: PostgreSQL 16 and later report it as a soft input error, and earlier majors roll back an internal subtransaction. Before PostgreSQL 16, transaction callbacks and parallel operations forbid that rollback; native errors there remain pending and throw PgException.
Properties
Section titled “Properties”Gets the maximum coordinate in each dimension.
public PgPoint High { get; }Value: PgPoint
Gets the minimum coordinate in each dimension.
public PgPoint Low { get; }Value: PgPoint
Operators
Section titled “Operators”operator ==(PgBox, PgBox)
Section titled “operator ==(PgBox, PgBox)”public static bool operator ==(PgBox left, PgBox right)Parameters:
left — PgBox
right — PgBox
Returns: bool
operator !=(PgBox, PgBox)
Section titled “operator !=(PgBox, PgBox)”public static bool operator !=(PgBox left, PgBox right)Parameters:
left — PgBox
right — PgBox
Returns: bool