Skip to content

PgLine

Namespace: Ankus

Assembly: Ankus.Runtime.dll

PostgreSQL line coefficients for Ax + By + C = 0. Equality compares coefficients exactly. PostgreSQL validates coefficients when converting to a datum; the all-zero default is not a valid SQL line.

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

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

PostgreSQL line coefficients for Ax + By + C = 0. Equality compares coefficients exactly. PostgreSQL validates coefficients when converting to a datum; the all-zero default is not a valid SQL line.

public PgLine(double A, double B, double C)

Parameters:

A — double

The horizontal coefficient.

B — double

The vertical coefficient.

C — double

The constant coefficient.

The horizontal coefficient.

public double A { get; init; }

Value: double

The vertical coefficient.

public double B { get; init; }

Value: double

The constant coefficient.

public double C { get; init; }

Value: double

Deconstruct(out double, out double, out double)

Section titled “Deconstruct(out double, out double, out double)”
public void Deconstruct(out double A, out double B, out double C)

Parameters:

A — double

B — double

C — double

public bool Equals(PgLine other)

Parameters:

other — PgLine

Returns: bool

public override bool Equals(object obj)

Parameters:

obj — object

Returns: bool

public override int GetHashCode()

Returns: int

Parses coefficients or two points using PostgreSQL on the active backend.

public static PgLine Parse(string text)

Parameters:

text — string

The line text.

Returns: PgLine

The parsed line.

Formats coefficients without backend access.

public override string ToString()

Returns: string

The coefficient 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 PgLine value)

Parameters:

text — string

The line text.

value — PgLine

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.

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

Parameters:

left — PgLine

right — PgLine

Returns: bool

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

Parameters:

left — PgLine

right — PgLine

Returns: bool