PgNumericPrecisionAttribute
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Applies PostgreSQL numeric precision and scale to a generated function parameter or return value. Values are rounded with PostgreSQL’s typmod rules, then checked for overflow.
[AttributeUsage(AttributeTargets.Parameter|AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]public sealed class PgNumericPrecisionAttribute : AttributeUse on PgNumeric or decimal, including nullable forms. Constraints apply at the SQL boundary; direct C# calls bypass them. Negative scales and scales above precision require PostgreSQL 15 or later. PostgreSQL function signatures themselves do not retain numeric type modifiers, so the generated dispatcher enforces this contract.
Inheritance: object, Attribute
Constructors
Section titled “Constructors”PgNumericPrecisionAttribute(int, int)
Section titled “PgNumericPrecisionAttribute(int, int)”Declares numeric precision and scale.
public PgNumericPrecisionAttribute(int precision, int scale = 0)Parameters:
precision — int
The maximum significant digits, one through 1000.
scale — int
The scale, -1000 through 1000. The default is zero.
Properties
Section titled “Properties”Element
Section titled “Element”Gets or sets the exact C# tuple element to constrain within a typed aggregate argument group. Omit for a scalar parameter or return value.
public string? Element { get; set; }Value: string
Precision
Section titled “Precision”Gets the maximum significant digits.
public int Precision { get; }Value: int
Gets the declared scale.
public int Scale { get; }Value: int