PgJsonb
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Owns the text representation of a PostgreSQL jsonb value. PostgreSQL normalizes it when constructing the native datum. The default value represents JSON null; use PgJsonb? for SQL NULL. Managed equality compares text ordinally.
[JsonConverter(typeof(PgJsonbConverter))]public readonly struct PgJsonb : IEquatable<PgJsonb>Implements: IEquatable<PgJsonb>
Constructors
Section titled “Constructors”PgJsonb(string)
Section titled “PgJsonb(string)”Creates a syntactically valid JSON value. PostgreSQL applies its additional jsonb constraints at the native boundary.
public PgJsonb(string text)Parameters:
text — string
One complete JSON value.
Methods
Section titled “Methods”Deserialize<T>(JsonTypeInfo<T>)
Section titled “Deserialize<T>(JsonTypeInfo<T>)”Deserializes this value using explicit metadata suitable for Native AOT.
public T? Deserialize<T>(JsonTypeInfo<T> typeInfo)Type parameters:
T
The target managed type.
Parameters:
typeInfo — JsonTypeInfo<T>
Usually a source-generated serialization context’s type metadata.
Returns: T
The deserialized value.
Equals(PgJsonb)
Section titled “Equals(PgJsonb)”Compares the stored text. Use PostgreSQL jsonb operators when structural SQL equality is required.
public bool Equals(PgJsonb other)Parameters:
other — PgJsonb
The other value.
Returns: bool
Whether both values contain the same text.
Equals(object)
Section titled “Equals(object)”public override bool Equals(object obj)Parameters:
obj — object
Returns: bool
GetHashCode()
Section titled “GetHashCode()”Gets an ordinal text hash consistent with equality.
public override int GetHashCode()Returns: int
The text hash.
Parse()
Section titled “Parse()”Parses an independently owned document. The caller must dispose it after use.
public JsonDocument Parse()Returns: JsonDocument
The owned JSON document.
Serialize<T>(T, JsonTypeInfo<T>)
Section titled “Serialize<T>(T, JsonTypeInfo<T>)”Serializes a managed value using explicit metadata suitable for Native AOT.
public static PgJsonb Serialize<T>(T value, JsonTypeInfo<T> typeInfo)Type parameters:
T
The managed type.
Parameters:
value — T
The value to serialize.
typeInfo — JsonTypeInfo<T>
The serialization metadata.
Returns: PgJsonb
An owned JSONB value.
ToString()
Section titled “ToString()”Returns the JSON text.
public override string ToString()Returns: string
The JSON text.
Properties
Section titled “Properties”Gets the JSON text. Values read from PostgreSQL use PostgreSQL’s normalized jsonb output format.
public string Text { get; }Value: string
Operators
Section titled “Operators”operator ==(PgJsonb, PgJsonb)
Section titled “operator ==(PgJsonb, PgJsonb)”public static bool operator ==(PgJsonb left, PgJsonb right)Parameters:
left — PgJsonb
right — PgJsonb
Returns: bool
operator !=(PgJsonb, PgJsonb)
Section titled “operator !=(PgJsonb, PgJsonb)”public static bool operator !=(PgJsonb left, PgJsonb right)Parameters:
left — PgJsonb
right — PgJsonb
Returns: bool