cashapp / pranadb

Apache License 2.0
612 stars 24 forks source link

Protobuf encoding for sinks #604

Open purplefox opened 2 years ago

purplefox commented 2 years ago

Implement InjectorProto on SelectorInjector

purplefox commented 2 years ago

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.