Path: redb/redb.Core/Models/Entities/RedbValue.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Core/Models/Entities/RedbValue.cs ---- using System; using System.Text.Json.Serialization; namespace redb.Core.Models.Entities { /// /// REDB value entity with direct data storage. /// Maps to _values table in PostgreSQL. /// Stores field values for objects (EAV pattern). /// public class RedbValue { /// /// Unique value identifier. /// [JsonPropertyName("id")] public long Id { get; set; } /// /// Structure (field definition) identifier. /// [JsonPropertyName("id_structure")] public long IdStructure { get; set; } /// /// Object identifier this value belongs to. /// [JsonPropertyName("id_object")] public long IdObject { get; set; } /// /// String value. /// [JsonPropertyName("string")] public string? String { get; set; } /// /// Long integer value. /// [JsonPropertyName("long")] public long? Long { get; set; } /// /// GUID value. /// [JsonPropertyName("guid")] public Guid? Guid { get; set; } /// /// Double value. /// [JsonPropertyName("double")] public double? Double { get; set; } /// /// DateTime with timezone value. /// [JsonPropertyName("date_time_offset")] public DateTimeOffset? DateTimeOffset { get; set; } /// /// Boolean value. /// [JsonPropertyName("boolean")] public bool? Boolean { get; set; } /// /// Binary data value. /// [JsonPropertyName("byte_array")] public byte[]? ByteArray { get; set; } /// /// Decimal value (high precision). /// [JsonPropertyName("numeric")] public decimal? Numeric { get; set; } /// /// List item reference ID. /// [JsonPropertyName("list_item")] public long? ListItem { get; set; } /// /// Object reference ID. /// [JsonPropertyName("object")] public long? Object { get; set; } /// /// Parent value ID for nested structures (arrays, dictionaries). /// [JsonPropertyName("array_parent_id")] public long? ArrayParentId { get; set; } /// /// Array index or dictionary key. /// For arrays: "0", "1", "2", etc. /// For dictionaries: string key. /// NULL for non-collection fields. /// [JsonPropertyName("array_index")] public string? ArrayIndex { get; set; } /// /// Unique-key hash of the typed value (UniqueKeyEncoder) for a [RedbUnique] root scalar; NULL /// for every other row. Backs the unique index over (_id_structure, _unique). /// [JsonPropertyName("unique")] public Guid? Unique { get; set; } /// /// Default constructor for deserialization and mapping. /// public RedbValue() { } /// /// Check if this is an array/collection element. /// [JsonIgnore] public bool IsArrayElement => !string.IsNullOrEmpty(ArrayIndex); public override string ToString() { var valueStr = String ?? Long?.ToString() ?? Guid?.ToString() ?? Double?.ToString() ?? Boolean?.ToString() ?? "[binary]"; var indexStr = IsArrayElement ? $"[{ArrayIndex}]" : ""; return $"Value {Id}: Struct={IdStructure}, Obj={IdObject}{indexStr} = {valueStr}"; } } }