pranadb icon indicating copy to clipboard operation
pranadb copied to clipboard

Protobuf encoding for sinks

Open purplefox opened this issue 2 years ago • 1 comments

Implement InjectorProto on SelectorInjector

purplefox avatar Oct 10 '22 11:10 purplefox

SelectProto is here https://github.com/cashapp/pranadb/blob/main/command/parser/selector/selector.go#L246

SelectorInjector is the thing that selects or injects values into/from a message.

The column selectors in the source definition define the selectors used to extract values from a message into columns.

Conversely the injectors in the sink definition define the injectors that determine where to inject values into the message taken from columns.

As you can see, Select and Inject for non protos have already been implemented, we just need to implement InjectProto. InjectProto takes a value and injects it into the proto according to the injector expression.

I got most of it working already in this branch https://github.com/cashapp/pranadb/blob/sinks_protobufs/command/parser/selector/selector.go#L241

Along with tests https://github.com/cashapp/pranadb/blob/sinks_protobufs/command/parser/selector/selector_test.go#L325

You could use that and finishing it off from there.

purplefox avatar Nov 05 '22 12:11 purplefox