Class TextInBinaryOutR2dbcCodec<A>

java.lang.Object
io.codemine.java.postgresql.TextInBinaryOutR2dbcCodec<A>
All Implemented Interfaces:
io.r2dbc.postgresql.codec.Codec<A>, io.r2dbc.postgresql.codec.CodecMetadata

public class TextInBinaryOutR2dbcCodec<A> extends Object implements io.r2dbc.postgresql.codec.Codec<A>, io.r2dbc.postgresql.codec.CodecMetadata
Adapts a Codec to the r2dbc-postgresql Codec SPI using text format for parameter encoding and binary format for result decoding.

Use this with a connection that has forceBinary enabled so that the server returns columns in binary format.

  • Constructor Details

    • TextInBinaryOutR2dbcCodec

      public TextInBinaryOutR2dbcCodec(Codec<A> codec, Class<A> type)
  • Method Details

    • canEncode

      public boolean canEncode(Object value)
      Specified by:
      canEncode in interface io.r2dbc.postgresql.codec.Codec<A>
    • canEncodeNull

      public boolean canEncodeNull(Class<?> cls)
      Specified by:
      canEncodeNull in interface io.r2dbc.postgresql.codec.Codec<A>
    • encode

      public io.r2dbc.postgresql.client.EncodedParameter encode(Object value)
      Specified by:
      encode in interface io.r2dbc.postgresql.codec.Codec<A>
    • encode

      public io.r2dbc.postgresql.client.EncodedParameter encode(Object value, int dataType)
      Specified by:
      encode in interface io.r2dbc.postgresql.codec.Codec<A>
    • encodeNull

      public io.r2dbc.postgresql.client.EncodedParameter encodeNull()
      Specified by:
      encodeNull in interface io.r2dbc.postgresql.codec.Codec<A>
    • type

      public Class<?> type()
      Specified by:
      type in interface io.r2dbc.postgresql.codec.CodecMetadata
    • getFormats

      public Iterable<io.r2dbc.postgresql.message.Format> getFormats()
      Specified by:
      getFormats in interface io.r2dbc.postgresql.codec.CodecMetadata
    • getDataTypes

      public Iterable<? extends io.r2dbc.postgresql.codec.PostgresTypeIdentifier> getDataTypes()
      Specified by:
      getDataTypes in interface io.r2dbc.postgresql.codec.CodecMetadata
    • canDecode

      public boolean canDecode(int dataType, io.r2dbc.postgresql.message.Format format, Class<?> requestedType)
      Specified by:
      canDecode in interface io.r2dbc.postgresql.codec.Codec<A>
    • decode

      public A decode(io.netty.buffer.ByteBuf buffer, int dataType, io.r2dbc.postgresql.message.Format format, Class<? extends A> requestedType)
      Specified by:
      decode in interface io.r2dbc.postgresql.codec.Codec<A>