Skip to content

IPgCustomScan<TState>

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Defines a custom scan provider that produces the rows of a plain table from managed code.

public interface IPgCustomScan<TState> where TState : class

Type parameters:

TState

The per-scan state, created when the executor starts the scan.

Apply PgCustomScanAttribute to the implementing class. PostgreSQL still evaluates the query’s conditions and projection on each row the provider produces. A state that implements IDisposable is disposed when the scan ends, including when the query fails. Implement IPgRescannableCustomScan<TState> to restart a scan in place, IPgScrollableCustomScan<TState> to read it backward, IPgMarkableCustomScan<TState> to return to a saved position and IPgExplainedCustomScan<TState> to add EXPLAIN properties.

Starts a scan the planner chose, including for EXPLAIN without ANALYZE.

public static abstract TState Begin(PgCustomScanContext context)

Parameters:

context — PgCustomScanContext

The scanned table and the data its path carried.

Returns: TState

The state passed to the scan’s other calls.

Offers paths for one table while PostgreSQL plans a query.

public static abstract void Plan(PgCustomScanPlanner planner)

Parameters:

planner — PgCustomScanPlanner

The table being planned and the costs of its existing paths.

Reads the scan’s next row, as System.Data.Common.DbDataReader.Read advances a reader.

public static abstract bool Read(TState state, PgHeapTuple row)

Parameters:

state — TState

The scan’s state.

row — PgHeapTuple

A new row of the table’s columns, all NULL until set.

Returns: bool

Whether a row was read; false ends the scan.