Struct PostgresCdcPosition
Represents a position in the Postgres Write-Ahead Log (WAL) for CDC tracking.
public readonly struct PostgresCdcPosition : IEquatable<PostgresCdcPosition>, IComparable<PostgresCdcPosition>
- Implements
- Inherited Members
Constructors
PostgresCdcPosition(NpgsqlLogSequenceNumber)
Initializes a new instance of the PostgresCdcPosition struct.
public PostgresCdcPosition(NpgsqlLogSequenceNumber lsn)
Parameters
lsnNpgsqlLogSequenceNumber
PostgresCdcPosition(string)
Initializes a new instance of the PostgresCdcPosition struct from an LSN string.
public PostgresCdcPosition(string lsnString)
Parameters
lsnStringstring
PostgresCdcPosition(ulong)
Initializes a new instance of the PostgresCdcPosition struct from a 64-bit value.
public PostgresCdcPosition(ulong lsnValue)
Parameters
lsnValueulong
Fields
Start
Represents the start of the WAL (position 0/0).
public static readonly PostgresCdcPosition Start
Field Value
Properties
IsValid
Gets a value indicating whether this position is valid.
public bool IsValid { get; }
Property Value
Lsn
Gets the underlying Npgsql log sequence number.
public NpgsqlLogSequenceNumber Lsn { get; }
Property Value
- NpgsqlLogSequenceNumber
LsnString
Gets the LSN as a string in the format "X/XXXXXXXX".
public string LsnString { get; }
Property Value
LsnValue
Gets the LSN as a 64-bit unsigned integer.
public ulong LsnValue { get; }
Property Value
Methods
CompareTo(PostgresCdcPosition)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(PostgresCdcPosition other)
Parameters
otherPostgresCdcPositionAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
Equals(PostgresCdcPosition)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(PostgresCdcPosition other)
Parameters
otherPostgresCdcPositionAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
FromChangePosition(ChangePosition?)
Creates a PostgresCdcPosition from a ChangePosition.
public static PostgresCdcPosition FromChangePosition(ChangePosition? position)
Parameters
positionChangePosition
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Parse(string)
Parses an LSN string to a PostgresCdcPosition.
public static PostgresCdcPosition Parse(string lsnString)
Parameters
lsnStringstring
Returns
ToChangePosition()
Converts this position to a ChangePosition.
public ChangePosition ToChangePosition()
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
TryParse(string?, out PostgresCdcPosition)
Tries to parse an LSN string to a PostgresCdcPosition.
public static bool TryParse(string? lsnString, out PostgresCdcPosition position)
Parameters
lsnStringstringpositionPostgresCdcPosition
Returns
Operators
operator ==(PostgresCdcPosition, PostgresCdcPosition)
Determines whether two positions are equal.
public static bool operator ==(PostgresCdcPosition left, PostgresCdcPosition right)
Parameters
leftPostgresCdcPositionrightPostgresCdcPosition
Returns
operator >(PostgresCdcPosition, PostgresCdcPosition)
Determines whether the left position is greater than the right position.
public static bool operator >(PostgresCdcPosition left, PostgresCdcPosition right)
Parameters
leftPostgresCdcPositionrightPostgresCdcPosition
Returns
operator >=(PostgresCdcPosition, PostgresCdcPosition)
Determines whether the left position is greater than or equal to the right position.
public static bool operator >=(PostgresCdcPosition left, PostgresCdcPosition right)
Parameters
leftPostgresCdcPositionrightPostgresCdcPosition
Returns
operator !=(PostgresCdcPosition, PostgresCdcPosition)
Determines whether two positions are not equal.
public static bool operator !=(PostgresCdcPosition left, PostgresCdcPosition right)
Parameters
leftPostgresCdcPositionrightPostgresCdcPosition
Returns
operator <(PostgresCdcPosition, PostgresCdcPosition)
Determines whether the left position is less than the right position.
public static bool operator <(PostgresCdcPosition left, PostgresCdcPosition right)
Parameters
leftPostgresCdcPositionrightPostgresCdcPosition
Returns
operator <=(PostgresCdcPosition, PostgresCdcPosition)
Determines whether the left position is less than or equal to the right position.
public static bool operator <=(PostgresCdcPosition left, PostgresCdcPosition right)
Parameters
leftPostgresCdcPositionrightPostgresCdcPosition