Skip to content

PgReplicatedRow

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Holds a row as logical replication carries it, for PgRelationWriter: each column’s value in PostgreSQL’s text or binary form, SQL NULL, or not sent.

public sealed class PgReplicatedRow

The writer converts each value with its column type's input or receive function, as the built-in apply worker does, so the values need no managed type. A column that is not sent takes its default in an insert and keeps its current value in an update, as an unchanged TOAST value does.

Columns are numbered from zero as in the writer's [Descriptor](/api/ankus.pgrelationwriter/#member-73d13a827c335765), including dropped columns, which must stay unsent or NULL. Text received from a [PgReplicationConnection](/api/ankus.pgreplicationconnection/) is already in the database's encoding and can be passed as bytes; text from a string is converted. Setting a column again replaces its value, and [Clear()](/api/ankus.pgreplicatedrow/#member-5f64cf81dc4f300c) makes the row reusable.

Inheritance: object

Marks every column as not sent.

public void Clear()

Sets a column to the binary form its type’s receive function reads, as COPY BINARY and binary logical replication send it.

public void SetBinary(int column, ReadOnlySpan<byte> value)

Parameters:

column — int

The zero-based column number.

value — ReadOnlySpan<byte>

The value’s bytes.

Sets a column to SQL NULL.

public void SetNull(int column)

Parameters:

column — int

The zero-based column number.

Sets a column to text in the database’s encoding, such as a value a replication connection received.

public void SetText(int column, ReadOnlySpan<byte> value)

Parameters:

column — int

The zero-based column number.

value — ReadOnlySpan<byte>

The text’s bytes, without a terminating zero.

Sets a column to text, which the writer converts to the database’s encoding.

public void SetText(int column, string value)

Parameters:

column — int

The zero-based column number.

value — string

The text.

Gets the number of columns, including dropped columns.

public int Count { get; }

Value: int