Skip to content

PgGucHooks<T>

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Supplies check, assign and show hooks for a configuration parameter defined at run time with PgGucRegistry, as pgrx’s define_*_guc_with_hooks functions accept hook functions.

public sealed class PgGucHooks<T>

Type parameters:

T

The parameter’s value type: bool, int, double, a nullable string, or the int value of an enumerated parameter’s label.

The hooks follow the rules for the hooks a [PgGucAttribute](/api/ankus.pggucattribute/) names: a check can normalize or reject a proposed value and attach [PgGucExtra](/api/ankus.pggucextra/), assign runs before PostgreSQL changes the value and must not fail, and show returns display text. Leave a hook null to omit it.

An extension can define at most 64 parameters with hooks. Defining a parameter again, as a retried module load does, must pass the same hook methods.

Inheritance: object

public PgGucHooks()

Gets the hook that runs before PostgreSQL assigns an accepted value, with its extra data.

public Action<T, PgGucExtra?>? Assign { get; init; }

Value: Action<T, PgGucExtra>

Gets the check that accepts, normalizes or rejects a proposed value.

public Func<T, PgGucSource, PgGucCheckResult<T>>? Check { get; init; }

Value: Func<T, PgGucSource, PgGucCheckResult<T>>

Gets the hook that formats the current value, with its extra data, for display.

public Func<T, PgGucExtra?, string>? Show { get; init; }

Value: Func<T, PgGucExtra, string>