PgNodeReference<T>
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Borrows a generated PostgreSQL node with checked bounds, ABI identity and native lifetime.
public sealed class PgNodeReference<T> where T : unmanaged, IPgNativeNodeType parameters:
T
The generated unmanaged node view.
Casts share the original allocation or raw-reference lifetime anchor and never acquire ownership. Pointer members retain their native safety obligations. Writing a tag or a pointer field does not establish that a complete, traversable native object exists at that address.
Inheritance: object
Methods
Section titled “Methods”DangerousToNativeString()
Section titled “DangerousToNativeString()”Copies PostgreSQL’s native nodeToString output into an independently owned managed string.
public string DangerousToNativeString()Returns: string
The exact native representation converted from the server encoding to Unicode.
The root’s ABI, concrete tag bounds, alignment and lifetime are checked. The caller must guarantee that all pointer members and variable-length tails form a valid native graph and remain alive and unchanged throughout native formatting, including reentrant callbacks. PostgreSQL errors return through the guarded boundary after native temporary storage is reclaimed.
IsA(uint)
Section titled “IsA(uint)”Tests the exact native tag, independently of inheritance-based cast acceptance.
public bool IsA(uint tag)Parameters:
tag — uint
The native NodeTag value to compare.
Returns: bool
Whether the stored tag is exactly equal.
TryCast<TTarget>()
Section titled “TryCast<TTarget>()”Tries a generated node cast while retaining the complete original storage extent and lifetime.
public PgNodeReference<TTarget>? TryCast<TTarget>() where TTarget : unmanaged, IPgNativeNodeType parameters:
TTarget
The generated target node representation.
Returns: PgNodeReference<TTarget>
A shared view, or null when the target’s native cast rules reject the stored tag.
Invalid storage, incompatible ABIs and insufficient target bounds throw rather than becoming a tag mismatch. Existing views observe allocation resizing, reset and deletion on every access.
Properties
Section titled “Properties”LifetimeContext
Section titled “LifetimeContext”Gets the original allocation owner or explicitly supplied raw-reference lifetime anchor.
public PgMemoryContext LifetimeContext { get; }Value: PgMemoryContext
Gets the exact native NodeTag bits without changing the stored value.
public uint Tag { get; }Value: uint
Gets or sets a copied complete value after validating this view’s ABI, alignment, bounds and lifetime.
public T Value { get; set; }Value: T