Skip to content

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>

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.

public void Deconstruct(out PgPoint Start, out PgPoint End)

Parameters:

Start — PgPoint

End — PgPoint

public bool Equals(PgLineSegment other)

Parameters:

other — PgLineSegment

Returns: bool

public override bool Equals(object obj)

Parameters:

obj — object

Returns: bool

public override int GetHashCode()

Returns: int

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.

Formats the endpoints without backend access.

public override string ToString()

Returns: string

The segment text.

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:

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:

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.

The second endpoint.

public PgPoint End { get; init; }

Value: PgPoint

The first endpoint.

public PgPoint Start { get; init; }

Value: PgPoint

public static bool operator ==(PgLineSegment left, PgLineSegment right)

Parameters:

left — PgLineSegment

right — PgLineSegment

Returns: bool

public static bool operator !=(PgLineSegment left, PgLineSegment right)

Parameters:

left — PgLineSegment

right — PgLineSegment

Returns: bool