PgLineSegment
Namespace: Ankus
Assembly: Ankus.Runtime.dll
An ordered pair of endpoints representing PostgreSQL lseg. Equality preserves endpoint order.
public readonly struct PgLineSegment : ISpanFormattable, IFormattable, IParsable<PgLineSegment>, IEquatable<PgLineSegment>Implements: ISpanFormattable, IFormattable, IParsable<PgLineSegment>, IEquatable<PgLineSegment>
Constructors
Section titled “Constructors”PgLineSegment(PgPoint, PgPoint)
Section titled “PgLineSegment(PgPoint, PgPoint)”An ordered pair of endpoints representing PostgreSQL lseg. Equality preserves endpoint order.
public PgLineSegment(PgPoint Start, PgPoint End)Parameters:
Start — PgPoint
The first endpoint.
End — PgPoint
The second endpoint.
Methods
Section titled “Methods”Deconstruct(out PgPoint, out PgPoint)
Section titled “Deconstruct(out PgPoint, out PgPoint)”public void Deconstruct(out PgPoint Start, out PgPoint End)Parameters:
Start — PgPoint
End — PgPoint
Equals(PgLineSegment)
Section titled “Equals(PgLineSegment)”public bool Equals(PgLineSegment other)Parameters:
other — PgLineSegment
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 segment using PostgreSQL on the active backend.
public static PgLineSegment Parse(string text)Parameters:
text — string
The segment text.
Returns: PgLineSegment
The parsed segment.
ToString()
Section titled “ToString()”Formats the endpoints without backend access.
public override string ToString()Returns: string
The segment 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 PgLineSegment)
Section titled “TryParse(string?, out PgLineSegment)”Tries PostgreSQL parsing without swallowing backend-access or operational errors.
public static bool TryParse(string? text, out PgLineSegment value)Parameters:
text — string
The segment text.
value — PgLineSegment
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”The second endpoint.
public PgPoint End { get; init; }Value: PgPoint
The first endpoint.
public PgPoint Start { get; init; }Value: PgPoint
Operators
Section titled “Operators”operator ==(PgLineSegment, PgLineSegment)
Section titled “operator ==(PgLineSegment, PgLineSegment)”public static bool operator ==(PgLineSegment left, PgLineSegment right)Parameters:
left — PgLineSegment
right — PgLineSegment
Returns: bool
operator !=(PgLineSegment, PgLineSegment)
Section titled “operator !=(PgLineSegment, PgLineSegment)”public static bool operator !=(PgLineSegment left, PgLineSegment right)Parameters:
left — PgLineSegment
right — PgLineSegment
Returns: bool