risingwave_connector::sink::encoder::avro

Trait MaybeData

source
trait MaybeData: Debug {
    type Out;

    // Required methods
    fn on_base(
        self,
        f: impl FnOnce(ScalarRefImpl<'_>) -> Result<Value, FieldEncodeError>,
    ) -> Result<Self::Out, FieldEncodeError>;
    fn on_struct(
        self,
        st: &StructType,
        avro: &AvroSchema,
    ) -> Result<Self::Out, FieldEncodeError>;
    fn on_list(
        self,
        elem: &DataType,
        avro: &AvroSchema,
    ) -> Result<Self::Out, FieldEncodeError>;
    fn on_map(
        self,
        value_type: &DataType,
        avro_value_schema: &AvroSchema,
    ) -> Result<Self::Out, FieldEncodeError>;
    fn handle_nullable_union(
        out: Self::Out,
        opt_idx: OptIdx,
    ) -> Result<Self::Out, FieldEncodeError>;
}
Expand description

A trait that assists code reuse between validate and encode.

  • For validate, the inputs are (RisingWave type, ProtoBuf type).
  • For encode, the inputs are (RisingWave type, RisingWave data, ProtoBuf type).

Thus we impl MaybeData for both [()] and DatumRef.

Required Associated Types§

Required Methods§

source

fn on_base( self, f: impl FnOnce(ScalarRefImpl<'_>) -> Result<Value, FieldEncodeError>, ) -> Result<Self::Out, FieldEncodeError>

source

fn on_struct( self, st: &StructType, avro: &AvroSchema, ) -> Result<Self::Out, FieldEncodeError>

Switch to RecordSchema after #12562

source

fn on_list( self, elem: &DataType, avro: &AvroSchema, ) -> Result<Self::Out, FieldEncodeError>

source

fn on_map( self, value_type: &DataType, avro_value_schema: &AvroSchema, ) -> Result<Self::Out, FieldEncodeError>

source

fn handle_nullable_union( out: Self::Out, opt_idx: OptIdx, ) -> Result<Self::Out, FieldEncodeError>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl MaybeData for ()

source§

type Out = ()

source§

fn on_base( self, _: impl FnOnce(ScalarRefImpl<'_>) -> Result<Value, FieldEncodeError>, ) -> Result<Self::Out, FieldEncodeError>

source§

fn on_struct( self, st: &StructType, avro: &AvroSchema, ) -> Result<Self::Out, FieldEncodeError>

source§

fn on_list( self, elem: &DataType, avro: &AvroSchema, ) -> Result<Self::Out, FieldEncodeError>

source§

fn on_map( self, elem: &DataType, avro: &AvroSchema, ) -> Result<Self::Out, FieldEncodeError>

source§

fn handle_nullable_union( out: Self::Out, _: OptIdx, ) -> Result<Self::Out, FieldEncodeError>

source§

impl MaybeData for DatumRef<'_>

source§

type Out = Value

source§

fn on_base( self, f: impl FnOnce(ScalarRefImpl<'_>) -> Result<Value, FieldEncodeError>, ) -> Result<Self::Out, FieldEncodeError>

source§

fn on_struct( self, st: &StructType, avro: &AvroSchema, ) -> Result<Self::Out, FieldEncodeError>

source§

fn on_list( self, elem: &DataType, avro: &AvroSchema, ) -> Result<Self::Out, FieldEncodeError>

source§

fn on_map( self, elem: &DataType, avro: &AvroSchema, ) -> Result<Self::Out, FieldEncodeError>

source§

fn handle_nullable_union( out: Self::Out, opt_idx: OptIdx, ) -> Result<Self::Out, FieldEncodeError>

Implementors§