Skip to content

PgAtomic

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Supplies wrapping arithmetic and atomic bitwise operations for PostgreSQL shared scalars.

public static class PgAtomic

Inheritance: object

Adds an integer with wrapping overflow and returns the updated value.

public static T Add<T>(this PgAtomic<T> storage, T value) where T : unmanaged, IBinaryInteger<T>

Type parameters:

T

A supported unmanaged binary integer.

Parameters:

storage — PgAtomic<T>

The registered scalar.

value — T

The amount to add.

Returns: T

The sum stored by this operation.

Stores the Boolean conjunction and returns the previous value.

public static bool And(this PgAtomic<bool> storage, bool value)

Parameters:

storage — PgAtomic<bool>

The registered Boolean scalar.

value — bool

The other operand.

Returns: bool

The value before the update.

Stores the bitwise AND and returns the previous value, following Interlocked.And.

public static T And<T>(this PgAtomic<T> storage, T value) where T : unmanaged, IBinaryInteger<T>

Type parameters:

T

A supported unmanaged binary integer.

Parameters:

storage — PgAtomic<T>

The registered scalar.

value — T

The bit mask.

Returns: T

The value before the update.

Subtracts one with wrapping overflow and returns the updated value.

public static T Decrement<T>(this PgAtomic<T> storage) where T : unmanaged, IBinaryInteger<T>

Type parameters:

T

A supported unmanaged binary integer.

Parameters:

storage — PgAtomic<T>

The registered scalar.

Returns: T

The decremented value.

Adds one with wrapping overflow and returns the updated value.

public static T Increment<T>(this PgAtomic<T> storage) where T : unmanaged, IBinaryInteger<T>

Type parameters:

T

A supported unmanaged binary integer.

Parameters:

storage — PgAtomic<T>

The registered scalar.

Returns: T

The incremented value.

Stores the larger of the current value and an operand and returns the previous value.

public static T Max<T>(this PgAtomic<T> storage, T value) where T : unmanaged, IBinaryInteger<T>

Type parameters:

T

A supported unmanaged binary integer.

Parameters:

storage — PgAtomic<T>

The registered scalar.

value — T

The other operand.

Returns: T

The value before the update.

Stores the smaller of the current value and an operand and returns the previous value.

public static T Min<T>(this PgAtomic<T> storage, T value) where T : unmanaged, IBinaryInteger<T>

Type parameters:

T

A supported unmanaged binary integer.

Parameters:

storage — PgAtomic<T>

The registered scalar.

value — T

The other operand.

Returns: T

The value before the update.

Stores the Boolean disjunction and returns the previous value.

public static bool Or(this PgAtomic<bool> storage, bool value)

Parameters:

storage — PgAtomic<bool>

The registered Boolean scalar.

value — bool

The other operand.

Returns: bool

The value before the update.

Stores the bitwise OR and returns the previous value, following Interlocked.Or.

public static T Or<T>(this PgAtomic<T> storage, T value) where T : unmanaged, IBinaryInteger<T>

Type parameters:

T

A supported unmanaged binary integer.

Parameters:

storage — PgAtomic<T>

The registered scalar.

value — T

The bit mask.

Returns: T

The value before the update.

Subtracts an integer with wrapping overflow and returns the updated value.

public static T Subtract<T>(this PgAtomic<T> storage, T value) where T : unmanaged, IBinaryInteger<T>

Type parameters:

T

A supported unmanaged binary integer.

Parameters:

storage — PgAtomic<T>

The registered scalar.

value — T

The amount to subtract.

Returns: T

The difference stored by this operation.

Stores the Boolean exclusive OR and returns the previous value.

public static bool Xor(this PgAtomic<bool> storage, bool value)

Parameters:

storage — PgAtomic<bool>

The registered Boolean scalar.

value — bool

The other operand.

Returns: bool

The value before the update.

Stores the bitwise exclusive OR and returns the previous value.

public static T Xor<T>(this PgAtomic<T> storage, T value) where T : unmanaged, IBinaryInteger<T>

Type parameters:

T

A supported unmanaged binary integer.

Parameters:

storage — PgAtomic<T>

The registered scalar.

value — T

The bit mask.

Returns: T

The value before the update.