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>
Constructors
Section titled “Constructors”PgLine(double, double, double)
Section titled “PgLine(double, double, double)”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.
Properties
Section titled “Properties”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
Methods
Section titled “Methods”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
Equals(PgLine)
Section titled “Equals(PgLine)”public bool Equals(PgLine other)Parameters:
other — PgLine
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 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.
ToString()
Section titled “ToString()”Formats coefficients without backend access.
public override string ToString()Returns: string
The coefficient 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 PgLine)
Section titled “TryParse(string?, out PgLine)”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.
Operators
Section titled “Operators”operator ==(PgLine, PgLine)
Section titled “operator ==(PgLine, PgLine)”public static bool operator ==(PgLine left, PgLine right)Parameters:
left — PgLine
right — PgLine
Returns: bool
operator !=(PgLine, PgLine)
Section titled “operator !=(PgLine, PgLine)”public static bool operator !=(PgLine left, PgLine right)Parameters:
left — PgLine
right — PgLine
Returns: bool