Skip to content

PgPoint

Namespace: Ankus

Assembly: Ankus.Runtime.dll

A PostgreSQL point with double-precision coordinates. Equality uses .NET value semantics, not geometric tolerance.

public readonly struct PgPoint : ISpanFormattable, IFormattable, IParsable<PgPoint>, IEquatable<PgPoint>

Implements: ISpanFormattable, IFormattable, IParsable<PgPoint>, IEquatable<PgPoint>

A PostgreSQL point with double-precision coordinates. Equality uses .NET value semantics, not geometric tolerance.

public PgPoint(double X, double Y)

Parameters:

X — double

The horizontal coordinate.

Y — double

The vertical coordinate.

public void Deconstruct(out double X, out double Y)

Parameters:

X — double

Y — double

public bool Equals(PgPoint other)

Parameters:

other — PgPoint

Returns: bool

public override bool Equals(object obj)

Parameters:

obj — object

Returns: bool

public override int GetHashCode()

Returns: int

Parses a point using PostgreSQL on the active backend.

public static PgPoint Parse(string text)

Parameters:

text — string

The point text.

Returns: PgPoint

The parsed point.

Formats round-trippable coordinates without backend access.

public override string ToString()

Returns: string

The point 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 PgPoint value)

Parameters:

text — string

The point text.

value — PgPoint

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 horizontal coordinate.

public double X { get; init; }

Value: double

The vertical coordinate.

public double Y { get; init; }

Value: double

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

Parameters:

left — PgPoint

right — PgPoint

Returns: bool

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

Parameters:

left — PgPoint

right — PgPoint

Returns: bool