Interface Type

All Known Implementing Classes:
AbstractConnectMapType, AbstractConnectSchemaType, AbstractTimestampType, AbstractTimeType, AbstractType, BitType, BitType, BitType, BooleanType, BytesType, BytesType, BytesType, CaseInsensitiveTextType, CidrType, ConnectBooleanType, ConnectBytesType, ConnectDateType, ConnectDecimalType, ConnectFloat32Type, ConnectFloat64Type, ConnectInt16Type, ConnectInt32Type, ConnectInt64Type, ConnectInt8Type, ConnectMapToConnectStringType, ConnectStringType, ConnectTimestampType, ConnectTimeType, DateType, EnumType, EnumType, InetType, IntegerType, IntervalType, JsonType, JsonType, LtreeType, MacAddressType, MapToHstoreType, MapToJsonType, MediumIntType, MicroTimestampType, MicroTimeType, MoneyType, NanoTimestampType, NanoTimeType, NumberType, OidType, PointType, RangeType, SerialType, SetType, TimestampType, TimeType, TimeWithTimezoneType, TinyIntType, UuidType, VariableScaleDecimalType, XmlType, XmlType, YearType, ZonedTimestampType, ZonedTimestampWithoutTimezoneType, ZonedTimestampWithoutTimezoneType, ZonedTimeType

public interface Type
A type represents a relational column type used for query abd parameter binding. todo: this is heavily modeled after Hibernate's type system which perhaps could be used instead? todo: is it possible to incorporate default value resolution into the type system?
Author:
Chris Cranford
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bind(org.hibernate.query.Query<?> query, int index, org.apache.kafka.connect.data.Schema schema, Object value)
    Binds the value to the query.
    getDefaultValueBinding(DatabaseDialect dialect, org.apache.kafka.connect.data.Schema schema, Object value)
    Resolve the default value clause value.
    getQueryBinding(org.apache.kafka.connect.data.Schema schema)
    Return the SQL string to be used in DML statements for binding this type to SQL.
    Returns the names that this type will be mapped as.
    getTypeName(DatabaseDialect dialect, org.apache.kafka.connect.data.Schema schema, boolean key)
    Return the SQL type name for this type.
  • Method Details

    • getRegistrationKeys

      String[] getRegistrationKeys()
      Returns the names that this type will be mapped as.

      For example, when creating a custom mapping for io.debezium.data.Bits, a type could be registered using the LOGICAL_NAME of the schema if the type is to be used when a schema name is identified; otherwise it could be registered as the raw column type when column type propagation is enabled.

    • getTypeName

      String getTypeName(DatabaseDialect dialect, org.apache.kafka.connect.data.Schema schema, boolean key)
      Return the SQL type name for this type.
      Parameters:
      dialect - dialect instance, never null
      schema - field schema, never null
      key - whether the type resolution is for a key field
      Returns:
      the resolved type to be used in DDL statements
    • getQueryBinding

      String getQueryBinding(org.apache.kafka.connect.data.Schema schema)
      Return the SQL string to be used in DML statements for binding this type to SQL.
      Parameters:
      schema - field schema, never null
      Returns:
      query parameter argument binding SQL fragment
    • getDefaultValueBinding

      String getDefaultValueBinding(DatabaseDialect dialect, org.apache.kafka.connect.data.Schema schema, Object value)
      Resolve the default value clause value.
      Parameters:
      dialect - dialect instance, never null
      schema - field schema, never null
      value - the default value, should not be null
      Returns:
      the formatted default value for the SQL statement as a string
    • bind

      void bind(org.hibernate.query.Query<?> query, int index, org.apache.kafka.connect.data.Schema schema, Object value)
      Binds the value to the query.
      Parameters:
      query - hibernate query, is never null
      index - parameter index to bind
      schema - field schema, never null
      value - value to be bound, may be null