FdbJsonValue<T>

Namespace: FoundationDB.Client · struct

Implements: IFdbValue, ISpanEncodable, ISpanFormattable, IFormattable, IEquatable<FdbRawValue>, IEquatable<IFdbValue>, IEquatable<Slice>, IEquatable<ReadOnlySpan<byte>>, IEquatable<FdbJsonValue<T>>, IEquatable<FdbJsonValue>

Value that wraps a JsonValue, encoded into UTF-8 bytes

Constructors

FdbJsonValue<T>

FdbJsonValue<T>(T data, IJsonSerializer<T> serializer = null, CrystalJsonSettings settings = null)

Methods

Equals

bool Equals(object obj)

bool Equals(IFdbValue other)

bool Equals(FdbJsonValue<T> other)

bool Equals(FdbJsonValue other)

bool Equals(FdbRawValue other)

bool Equals(Slice other)

bool Equals(ReadOnlySpan<byte> other)

GetHashCode

int GetHashCode()

GetTypeHint

FdbValueTypeHint GetTypeHint()

Returns a hint on how to interpret this value

ToString

string ToString()

string ToString(string format, IFormatProvider formatProvider = null)

TryEncode

bool TryEncode(Span<byte> destination, out int bytesWritten)

Encodes this instance into its equivalent binary representation in the database

  • destination — Destination buffer
  • bytesWritten — Number of bytes written to the buffer

Returns: true if the operation was successful and the buffer was large enough, or false if it was too small

TryFormat

bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider provider)

TryGetSizeHint

bool TryGetSizeHint(out int sizeHint)

Returns a quick estimate of the initial buffer size that would be large enough to encode this instance, in a single call to TryEncode

  • sizeHint — Receives an initial capacity that will satisfy almost all values. There is no guarantees that the size will be exact, and the estimate may be smaller or larger than the actual encoded size.

Returns: true if a size could be quickly computed; otherwise, false

TryGetSpan

bool TryGetSpan(out ReadOnlySpan<byte> span)

Returns the already encoded binary representation of the instance, if already available.

  • span — Points to the in-memory binary representation of the encoded key

Returns: true if the key has already been encoded, or it its in-memory layout is the same; otherwise, false

This is only intended to support pass-through or already encoded keys (via Slice), or when the binary representation has been cached to allow multiple uses.

Fields

Data

readonly T Data

Serialized instance

JsonSettings

readonly CrystalJsonSettings JsonSettings

JSON Serialization Settings

Serializer

readonly IJsonSerializer<T> Serializer

Custom Serializer (optional)