syntax = "proto3"; option cc_enable_arenas = true; import "google/protobuf/struct.proto"; package Ydb; option go_package = "github.com/ydb-platform/ydb-go-genproto/protos/Ydb"; option java_package = "tech.ydb"; option java_outer_classname = "ValueProtos"; message DecimalType { uint32 precision = 1; uint32 scale = 2; } message OptionalType { Type item = 1; } message ListType { Type item = 1; } message VariantType { oneof type { TupleType tuple_items = 1; StructType struct_items = 2; } } message TupleType { repeated Type elements = 1; } message StructMember { string name = 1; Type type = 2; } message StructType { repeated StructMember members = 1; } message DictType { Type key = 1; Type payload = 2; } message TaggedType { string tag = 1; Type type = 2; } message PgType { // pg object id of the type // full registry could be found here: https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.dat uint32 oid = 1; // required // advanced type details useful for pg wire format proxying int32 typlen = 2; // optional, set to 0 by default int32 typmod = 3; // optional, set to 0 by default } message Type { enum PrimitiveTypeId { PRIMITIVE_TYPE_ID_UNSPECIFIED = 0x0000; BOOL = 0x0006; INT8 = 0x0007; UINT8 = 0x0005; INT16 = 0x0008; UINT16 = 0x0009; INT32 = 0x0001; UINT32 = 0x0002; INT64 = 0x0003; UINT64 = 0x0004; FLOAT = 0x0021; DOUBLE = 0x0020; DATE = 0x0030; DATETIME = 0x0031; TIMESTAMP = 0x0032; INTERVAL = 0x0033; TZ_DATE = 0x0034; TZ_DATETIME = 0x0035; TZ_TIMESTAMP = 0x0036; STRING = 0x1001; UTF8 = 0x1200; YSON = 0x1201; JSON = 0x1202; UUID = 0x1203; JSON_DOCUMENT = 0x1204; DYNUMBER = 0x1302; } oneof type { /* Data types */ PrimitiveTypeId type_id = 1; DecimalType decimal_type = 2; /* Container types */ OptionalType optional_type = 101; ListType list_type = 102; TupleType tuple_type = 103; StructType struct_type = 104; DictType dict_type = 105; VariantType variant_type = 106; TaggedType tagged_type = 107; /* Special types */ google.protobuf.NullValue void_type = 201; google.protobuf.NullValue null_type = 202; google.protobuf.NullValue empty_list_type = 203; google.protobuf.NullValue empty_dict_type = 204; PgType pg_type = 205; } } /** * Holds a pair to represent Dict type */ message ValuePair { Value key = 1; Value payload = 2; } /** * This message represents any of the supported by transport value types. * Note, this is not actually a Ydb types. See NYql.NProto.TypeIds for Ydb types. * * For scalar types, just oneof value used. * For composite types repeated Items or Pairs used. See below. * * The idea is, we do not represent explicitly Optional if value is not null (most common case) * - just represents value of T. Number of Optional levels we can get from type. * Variant type always represent explicitly * PgType could be stored either in text_value (human-readable format) or bytes_value (internal wire format) */ message Value { oneof value { bool bool_value = 1; sfixed32 int32_value = 2; fixed32 uint32_value = 3; sfixed64 int64_value = 4; fixed64 uint64_value = 5; float float_value = 6; double double_value = 7; bytes bytes_value = 8; string text_value = 9; google.protobuf.NullValue null_flag_value = 10; // Set if current TValue is terminal Null Value nested_value = 11; // Represents nested TValue for Optional>(Null), or Variant types fixed64 low_128 = 15; } repeated Value items = 12; // Used for List, Tuple, Struct types repeated ValuePair pairs = 13; // Used for Dict type uint32 variant_index = 14; // Used for Variant type fixed64 high_128 = 16; } message TypedValue { Type type = 1; Value value = 2; } message Column { // Name of column string name = 1; // Type of column Type type = 2; } // Represents table-like structure with ordered set of rows and columns message ResultSet { // Metadata of columns repeated Column columns = 1; // Rows of table repeated Value rows = 2; // Flag indicates the result was truncated bool truncated = 3; }