mirror of
https://github.com/debezium/postgres-decoderbufs.git
synced 2026-02-04 06:56:22 +00:00
Use oneof for different datum field types
This commit is contained in:
@@ -218,11 +218,11 @@ static const ProtobufCFieldDescriptor decoderbufs__datum_message__field_descript
|
||||
3,
|
||||
PROTOBUF_C_LABEL_OPTIONAL,
|
||||
PROTOBUF_C_TYPE_INT32,
|
||||
offsetof(Decoderbufs__DatumMessage, has_datum_int32),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_case),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_int32),
|
||||
NULL,
|
||||
NULL,
|
||||
0, /* flags */
|
||||
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
|
||||
0,NULL,NULL /* reserved1,reserved2, etc */
|
||||
},
|
||||
{
|
||||
@@ -230,11 +230,11 @@ static const ProtobufCFieldDescriptor decoderbufs__datum_message__field_descript
|
||||
4,
|
||||
PROTOBUF_C_LABEL_OPTIONAL,
|
||||
PROTOBUF_C_TYPE_INT64,
|
||||
offsetof(Decoderbufs__DatumMessage, has_datum_int64),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_case),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_int64),
|
||||
NULL,
|
||||
NULL,
|
||||
0, /* flags */
|
||||
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
|
||||
0,NULL,NULL /* reserved1,reserved2, etc */
|
||||
},
|
||||
{
|
||||
@@ -242,11 +242,11 @@ static const ProtobufCFieldDescriptor decoderbufs__datum_message__field_descript
|
||||
5,
|
||||
PROTOBUF_C_LABEL_OPTIONAL,
|
||||
PROTOBUF_C_TYPE_FLOAT,
|
||||
offsetof(Decoderbufs__DatumMessage, has_datum_float),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_case),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_float),
|
||||
NULL,
|
||||
NULL,
|
||||
0, /* flags */
|
||||
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
|
||||
0,NULL,NULL /* reserved1,reserved2, etc */
|
||||
},
|
||||
{
|
||||
@@ -254,11 +254,11 @@ static const ProtobufCFieldDescriptor decoderbufs__datum_message__field_descript
|
||||
6,
|
||||
PROTOBUF_C_LABEL_OPTIONAL,
|
||||
PROTOBUF_C_TYPE_DOUBLE,
|
||||
offsetof(Decoderbufs__DatumMessage, has_datum_double),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_case),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_double),
|
||||
NULL,
|
||||
NULL,
|
||||
0, /* flags */
|
||||
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
|
||||
0,NULL,NULL /* reserved1,reserved2, etc */
|
||||
},
|
||||
{
|
||||
@@ -266,11 +266,11 @@ static const ProtobufCFieldDescriptor decoderbufs__datum_message__field_descript
|
||||
7,
|
||||
PROTOBUF_C_LABEL_OPTIONAL,
|
||||
PROTOBUF_C_TYPE_BOOL,
|
||||
offsetof(Decoderbufs__DatumMessage, has_datum_bool),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_case),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_bool),
|
||||
NULL,
|
||||
NULL,
|
||||
0, /* flags */
|
||||
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
|
||||
0,NULL,NULL /* reserved1,reserved2, etc */
|
||||
},
|
||||
{
|
||||
@@ -278,11 +278,11 @@ static const ProtobufCFieldDescriptor decoderbufs__datum_message__field_descript
|
||||
8,
|
||||
PROTOBUF_C_LABEL_OPTIONAL,
|
||||
PROTOBUF_C_TYPE_STRING,
|
||||
0, /* quantifier_offset */
|
||||
offsetof(Decoderbufs__DatumMessage, datum_case),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_string),
|
||||
NULL,
|
||||
NULL,
|
||||
0, /* flags */
|
||||
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
|
||||
0,NULL,NULL /* reserved1,reserved2, etc */
|
||||
},
|
||||
{
|
||||
@@ -290,11 +290,11 @@ static const ProtobufCFieldDescriptor decoderbufs__datum_message__field_descript
|
||||
9,
|
||||
PROTOBUF_C_LABEL_OPTIONAL,
|
||||
PROTOBUF_C_TYPE_BYTES,
|
||||
offsetof(Decoderbufs__DatumMessage, has_datum_bytes),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_case),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_bytes),
|
||||
NULL,
|
||||
NULL,
|
||||
0, /* flags */
|
||||
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
|
||||
0,NULL,NULL /* reserved1,reserved2, etc */
|
||||
},
|
||||
{
|
||||
@@ -302,11 +302,11 @@ static const ProtobufCFieldDescriptor decoderbufs__datum_message__field_descript
|
||||
10,
|
||||
PROTOBUF_C_LABEL_OPTIONAL,
|
||||
PROTOBUF_C_TYPE_MESSAGE,
|
||||
0, /* quantifier_offset */
|
||||
offsetof(Decoderbufs__DatumMessage, datum_case),
|
||||
offsetof(Decoderbufs__DatumMessage, datum_point),
|
||||
&decoderbufs__point__descriptor,
|
||||
NULL,
|
||||
0, /* flags */
|
||||
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
|
||||
0,NULL,NULL /* reserved1,reserved2, etc */
|
||||
},
|
||||
};
|
||||
@@ -342,13 +342,25 @@ const ProtobufCMessageDescriptor decoderbufs__datum_message__descriptor =
|
||||
(ProtobufCMessageInit) decoderbufs__datum_message__init,
|
||||
NULL,NULL,NULL /* reserved[123] */
|
||||
};
|
||||
static const ProtobufCFieldDescriptor decoderbufs__row_message__field_descriptors[5] =
|
||||
static const ProtobufCFieldDescriptor decoderbufs__row_message__field_descriptors[6] =
|
||||
{
|
||||
{
|
||||
"commit_time",
|
||||
"transaction_id",
|
||||
1,
|
||||
PROTOBUF_C_LABEL_OPTIONAL,
|
||||
PROTOBUF_C_TYPE_SINT64,
|
||||
PROTOBUF_C_TYPE_UINT32,
|
||||
offsetof(Decoderbufs__RowMessage, has_transaction_id),
|
||||
offsetof(Decoderbufs__RowMessage, transaction_id),
|
||||
NULL,
|
||||
NULL,
|
||||
0, /* flags */
|
||||
0,NULL,NULL /* reserved1,reserved2, etc */
|
||||
},
|
||||
{
|
||||
"commit_time",
|
||||
2,
|
||||
PROTOBUF_C_LABEL_OPTIONAL,
|
||||
PROTOBUF_C_TYPE_UINT64,
|
||||
offsetof(Decoderbufs__RowMessage, has_commit_time),
|
||||
offsetof(Decoderbufs__RowMessage, commit_time),
|
||||
NULL,
|
||||
@@ -358,7 +370,7 @@ static const ProtobufCFieldDescriptor decoderbufs__row_message__field_descriptor
|
||||
},
|
||||
{
|
||||
"table",
|
||||
2,
|
||||
3,
|
||||
PROTOBUF_C_LABEL_OPTIONAL,
|
||||
PROTOBUF_C_TYPE_STRING,
|
||||
0, /* quantifier_offset */
|
||||
@@ -370,7 +382,7 @@ static const ProtobufCFieldDescriptor decoderbufs__row_message__field_descriptor
|
||||
},
|
||||
{
|
||||
"op",
|
||||
3,
|
||||
4,
|
||||
PROTOBUF_C_LABEL_OPTIONAL,
|
||||
PROTOBUF_C_TYPE_ENUM,
|
||||
offsetof(Decoderbufs__RowMessage, has_op),
|
||||
@@ -382,7 +394,7 @@ static const ProtobufCFieldDescriptor decoderbufs__row_message__field_descriptor
|
||||
},
|
||||
{
|
||||
"new_tuple",
|
||||
4,
|
||||
5,
|
||||
PROTOBUF_C_LABEL_REPEATED,
|
||||
PROTOBUF_C_TYPE_MESSAGE,
|
||||
offsetof(Decoderbufs__RowMessage, n_new_tuple),
|
||||
@@ -394,7 +406,7 @@ static const ProtobufCFieldDescriptor decoderbufs__row_message__field_descriptor
|
||||
},
|
||||
{
|
||||
"old_tuple",
|
||||
5,
|
||||
6,
|
||||
PROTOBUF_C_LABEL_REPEATED,
|
||||
PROTOBUF_C_TYPE_MESSAGE,
|
||||
offsetof(Decoderbufs__RowMessage, n_old_tuple),
|
||||
@@ -406,16 +418,17 @@ static const ProtobufCFieldDescriptor decoderbufs__row_message__field_descriptor
|
||||
},
|
||||
};
|
||||
static const unsigned decoderbufs__row_message__field_indices_by_name[] = {
|
||||
0, /* field[0] = commit_time */
|
||||
3, /* field[3] = new_tuple */
|
||||
4, /* field[4] = old_tuple */
|
||||
2, /* field[2] = op */
|
||||
1, /* field[1] = table */
|
||||
1, /* field[1] = commit_time */
|
||||
4, /* field[4] = new_tuple */
|
||||
5, /* field[5] = old_tuple */
|
||||
3, /* field[3] = op */
|
||||
2, /* field[2] = table */
|
||||
0, /* field[0] = transaction_id */
|
||||
};
|
||||
static const ProtobufCIntRange decoderbufs__row_message__number_ranges[1 + 1] =
|
||||
{
|
||||
{ 1, 0 },
|
||||
{ 0, 5 }
|
||||
{ 0, 6 }
|
||||
};
|
||||
const ProtobufCMessageDescriptor decoderbufs__row_message__descriptor =
|
||||
{
|
||||
@@ -425,14 +438,14 @@ const ProtobufCMessageDescriptor decoderbufs__row_message__descriptor =
|
||||
"Decoderbufs__RowMessage",
|
||||
"decoderbufs",
|
||||
sizeof(Decoderbufs__RowMessage),
|
||||
5,
|
||||
6,
|
||||
decoderbufs__row_message__field_descriptors,
|
||||
decoderbufs__row_message__field_indices_by_name,
|
||||
1, decoderbufs__row_message__number_ranges,
|
||||
(ProtobufCMessageInit) decoderbufs__row_message__init,
|
||||
NULL,NULL,NULL /* reserved[123] */
|
||||
};
|
||||
const ProtobufCEnumValue decoderbufs__op__enum_values_by_number[3] =
|
||||
static const ProtobufCEnumValue decoderbufs__op__enum_values_by_number[3] =
|
||||
{
|
||||
{ "INSERT", "DECODERBUFS__OP__INSERT", 0 },
|
||||
{ "UPDATE", "DECODERBUFS__OP__UPDATE", 1 },
|
||||
@@ -441,7 +454,7 @@ const ProtobufCEnumValue decoderbufs__op__enum_values_by_number[3] =
|
||||
static const ProtobufCIntRange decoderbufs__op__value_ranges[] = {
|
||||
{0, 0},{0, 3}
|
||||
};
|
||||
const ProtobufCEnumValueIndex decoderbufs__op__enum_values_by_name[3] =
|
||||
static const ProtobufCEnumValueIndex decoderbufs__op__enum_values_by_name[3] =
|
||||
{
|
||||
{ "DELETE", 2 },
|
||||
{ "INSERT", 0 },
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* Generated by the protocol buffer compiler. DO NOT EDIT! */
|
||||
/* Generated from: pg_logicaldec.proto */
|
||||
|
||||
#ifndef PROTOBUF_C_proto_2fpg_5flogicaldec_2eproto__INCLUDED
|
||||
#define PROTOBUF_C_proto_2fpg_5flogicaldec_2eproto__INCLUDED
|
||||
#ifndef PROTOBUF_C_pg_5flogicaldec_2eproto__INCLUDED
|
||||
#define PROTOBUF_C_pg_5flogicaldec_2eproto__INCLUDED
|
||||
|
||||
#include <protobuf-c/protobuf-c.h>
|
||||
|
||||
@@ -10,7 +10,7 @@ PROTOBUF_C__BEGIN_DECLS
|
||||
|
||||
#if PROTOBUF_C_VERSION_NUMBER < 1000000
|
||||
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
|
||||
#elif 1001000 < PROTOBUF_C_MIN_COMPILER_VERSION
|
||||
#elif 1001001 < PROTOBUF_C_MIN_COMPILER_VERSION
|
||||
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
|
||||
#endif
|
||||
|
||||
@@ -42,37 +42,48 @@ struct _Decoderbufs__Point
|
||||
, 0, 0 }
|
||||
|
||||
|
||||
typedef enum {
|
||||
DECODERBUFS__DATUM_MESSAGE__DATUM__NOT_SET = 0,
|
||||
DECODERBUFS__DATUM_MESSAGE__DATUM_DATUM_INT32 = 3,
|
||||
DECODERBUFS__DATUM_MESSAGE__DATUM_DATUM_INT64 = 4,
|
||||
DECODERBUFS__DATUM_MESSAGE__DATUM_DATUM_FLOAT = 5,
|
||||
DECODERBUFS__DATUM_MESSAGE__DATUM_DATUM_DOUBLE = 6,
|
||||
DECODERBUFS__DATUM_MESSAGE__DATUM_DATUM_BOOL = 7,
|
||||
DECODERBUFS__DATUM_MESSAGE__DATUM_DATUM_STRING = 8,
|
||||
DECODERBUFS__DATUM_MESSAGE__DATUM_DATUM_BYTES = 9,
|
||||
DECODERBUFS__DATUM_MESSAGE__DATUM_DATUM_POINT = 10,
|
||||
} Decoderbufs__DatumMessage__DatumCase;
|
||||
|
||||
struct _Decoderbufs__DatumMessage
|
||||
{
|
||||
ProtobufCMessage base;
|
||||
char *column_name;
|
||||
protobuf_c_boolean has_column_type;
|
||||
int64_t column_type;
|
||||
protobuf_c_boolean has_datum_int32;
|
||||
int32_t datum_int32;
|
||||
protobuf_c_boolean has_datum_int64;
|
||||
int64_t datum_int64;
|
||||
protobuf_c_boolean has_datum_float;
|
||||
float datum_float;
|
||||
protobuf_c_boolean has_datum_double;
|
||||
double datum_double;
|
||||
protobuf_c_boolean has_datum_bool;
|
||||
protobuf_c_boolean datum_bool;
|
||||
char *datum_string;
|
||||
protobuf_c_boolean has_datum_bytes;
|
||||
ProtobufCBinaryData datum_bytes;
|
||||
Decoderbufs__Point *datum_point;
|
||||
Decoderbufs__DatumMessage__DatumCase datum_case;
|
||||
union {
|
||||
int32_t datum_int32;
|
||||
int64_t datum_int64;
|
||||
float datum_float;
|
||||
double datum_double;
|
||||
protobuf_c_boolean datum_bool;
|
||||
char *datum_string;
|
||||
ProtobufCBinaryData datum_bytes;
|
||||
Decoderbufs__Point *datum_point;
|
||||
};
|
||||
};
|
||||
#define DECODERBUFS__DATUM_MESSAGE__INIT \
|
||||
{ PROTOBUF_C_MESSAGE_INIT (&decoderbufs__datum_message__descriptor) \
|
||||
, NULL, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, NULL, 0,{0,NULL}, NULL }
|
||||
, NULL, 0,0, DECODERBUFS__DATUM_MESSAGE__DATUM__NOT_SET, {} }
|
||||
|
||||
|
||||
struct _Decoderbufs__RowMessage
|
||||
{
|
||||
ProtobufCMessage base;
|
||||
protobuf_c_boolean has_transaction_id;
|
||||
uint32_t transaction_id;
|
||||
protobuf_c_boolean has_commit_time;
|
||||
int64_t commit_time;
|
||||
uint64_t commit_time;
|
||||
char *table;
|
||||
protobuf_c_boolean has_op;
|
||||
Decoderbufs__Op op;
|
||||
@@ -83,7 +94,7 @@ struct _Decoderbufs__RowMessage
|
||||
};
|
||||
#define DECODERBUFS__ROW_MESSAGE__INIT \
|
||||
{ PROTOBUF_C_MESSAGE_INIT (&decoderbufs__row_message__descriptor) \
|
||||
, 0,0, NULL, 0,0, 0,NULL, 0,NULL }
|
||||
, 0,0, 0,0, NULL, 0,0, 0,NULL, 0,NULL }
|
||||
|
||||
|
||||
/* Decoderbufs__Point methods */
|
||||
@@ -168,4 +179,4 @@ extern const ProtobufCMessageDescriptor decoderbufs__row_message__descriptor;
|
||||
PROTOBUF_C__END_DECLS
|
||||
|
||||
|
||||
#endif /* PROTOBUF_C_proto_2fpg_5flogicaldec_2eproto__INCLUDED */
|
||||
#endif /* PROTOBUF_C_pg_5flogicaldec_2eproto__INCLUDED */
|
||||
|
||||
Reference in New Issue
Block a user