-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Optimization-3146][CDCSOURCE] Use spotless to format the code
- Loading branch information
Showing
14 changed files
with
63 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,15 @@ | |
|
||
package org.dinky.cdc.debezium.converter; | ||
|
||
import com.ververica.cdc.connectors.shaded.org.apache.kafka.connect.data.SchemaBuilder; | ||
import io.debezium.spi.converter.RelationalColumn; | ||
import org.dinky.cdc.debezium.DebeziumCustomConverter; | ||
|
||
import java.time.Instant; | ||
import java.time.ZoneOffset; | ||
|
||
import com.ververica.cdc.connectors.shaded.org.apache.kafka.connect.data.SchemaBuilder; | ||
|
||
import io.debezium.spi.converter.RelationalColumn; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Kindbgen<a/> | ||
* @description Mysql 转换器 | ||
|
@@ -34,7 +36,8 @@ | |
public class MysqlDebeziumConverter extends DebeziumCustomConverter { | ||
|
||
@Override | ||
public void converterFor(RelationalColumn relationalColumn, ConverterRegistration<SchemaBuilder> converterRegistration) { | ||
public void converterFor( | ||
RelationalColumn relationalColumn, ConverterRegistration<SchemaBuilder> converterRegistration) { | ||
// 获取字段类型 | ||
String columnType = relationalColumn.typeName().toUpperCase(); | ||
this.registerConverter(columnType, converterRegistration); | ||
|
@@ -63,9 +66,7 @@ public void registerConverter(String columnType, ConverterRegistration<SchemaBui | |
return null; | ||
} else if (value instanceof java.time.Duration) { | ||
return timeFormatter.format( | ||
java.time.LocalTime. | ||
ofNanoOfDay(((java.time.Duration) value) | ||
.toNanos())); | ||
java.time.LocalTime.ofNanoOfDay(((java.time.Duration) value).toNanos())); | ||
} else if (value instanceof java.time.LocalDateTime) { | ||
return datetimeFormatter.format((java.time.LocalDateTime) value); | ||
} else { | ||
|
@@ -81,7 +82,9 @@ public void registerConverter(String columnType, ConverterRegistration<SchemaBui | |
} else if (value instanceof java.time.LocalDateTime) { | ||
return datetimeFormatter.format((java.time.LocalDateTime) value); | ||
} else if (value instanceof java.time.ZonedDateTime) { | ||
return datetimeFormatter.format(((java.time.ZonedDateTime) value).withZoneSameInstant(zoneId).toLocalDateTime()); | ||
return datetimeFormatter.format(((java.time.ZonedDateTime) value) | ||
.withZoneSameInstant(zoneId) | ||
.toLocalDateTime()); | ||
} else if (value instanceof java.sql.Timestamp) { | ||
return datetimeFormatter.format(((java.sql.Timestamp) value).toLocalDateTime()); | ||
} else if (value instanceof String) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,11 @@ | |
|
||
package org.dinky.cdc.debezium.converter; | ||
|
||
import org.dinky.cdc.debezium.DebeziumCustomConverter; | ||
|
||
import com.ververica.cdc.connectors.shaded.org.apache.kafka.connect.data.SchemaBuilder; | ||
|
||
import io.debezium.spi.converter.RelationalColumn; | ||
import org.dinky.cdc.debezium.DebeziumCustomConverter; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Kindbgen<a/> | ||
|
@@ -31,7 +33,8 @@ | |
public class OracleDebeziumConverter extends DebeziumCustomConverter { | ||
|
||
@Override | ||
public void converterFor(RelationalColumn relationalColumn, ConverterRegistration<SchemaBuilder> converterRegistration) { | ||
public void converterFor( | ||
RelationalColumn relationalColumn, ConverterRegistration<SchemaBuilder> converterRegistration) { | ||
// 获取字段类型 | ||
String columnType = relationalColumn.typeName().toUpperCase(); | ||
this.registerConverter(columnType, converterRegistration); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,11 @@ | |
|
||
package org.dinky.cdc.debezium.converter; | ||
|
||
import org.dinky.cdc.debezium.DebeziumCustomConverter; | ||
|
||
import com.ververica.cdc.connectors.shaded.org.apache.kafka.connect.data.SchemaBuilder; | ||
|
||
import io.debezium.spi.converter.RelationalColumn; | ||
import org.dinky.cdc.debezium.DebeziumCustomConverter; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Kindbgen<a/> | ||
|
@@ -30,7 +32,8 @@ | |
*/ | ||
public class PostgresDebeziumConverter extends DebeziumCustomConverter { | ||
@Override | ||
public void converterFor(RelationalColumn relationalColumn, ConverterRegistration<SchemaBuilder> converterRegistration) { | ||
public void converterFor( | ||
RelationalColumn relationalColumn, ConverterRegistration<SchemaBuilder> converterRegistration) { | ||
// 获取字段类型 | ||
String columnType = relationalColumn.typeName().toUpperCase(); | ||
this.registerConverter(columnType, converterRegistration); | ||
|
@@ -84,5 +87,4 @@ public void registerConverter(String columnType, ConverterRegistration<SchemaBui | |
break; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,20 +19,23 @@ | |
|
||
package org.dinky.cdc.debezium.converter; | ||
|
||
import com.ververica.cdc.connectors.shaded.org.apache.kafka.connect.data.SchemaBuilder; | ||
import io.debezium.spi.converter.RelationalColumn; | ||
import org.dinky.cdc.debezium.DebeziumCustomConverter; | ||
|
||
import java.time.ZoneOffset; | ||
|
||
import com.ververica.cdc.connectors.shaded.org.apache.kafka.connect.data.SchemaBuilder; | ||
|
||
import io.debezium.spi.converter.RelationalColumn; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Kindbgen<a/> | ||
* @description SqlServer 转换器 | ||
* @date 2024/2/6 | ||
*/ | ||
public class SqlServerDebeziumConverter extends DebeziumCustomConverter { | ||
@Override | ||
public void converterFor(RelationalColumn relationalColumn, ConverterRegistration<SchemaBuilder> converterRegistration) { | ||
public void converterFor( | ||
RelationalColumn relationalColumn, ConverterRegistration<SchemaBuilder> converterRegistration) { | ||
// 获取字段类型 | ||
String columnType = relationalColumn.typeName().toUpperCase(); | ||
this.registerConverter(columnType, converterRegistration); | ||
|
@@ -62,7 +65,8 @@ public void registerConverter(String columnType, ConverterRegistration<SchemaBui | |
} else if (value instanceof java.sql.Time) { | ||
return timeFormatter.format(((java.sql.Time) value).toLocalTime()); | ||
} else if (value instanceof java.sql.Timestamp) { | ||
return timeFormatter.format(((java.sql.Timestamp) value).toLocalDateTime().toLocalTime()); | ||
return timeFormatter.format( | ||
((java.sql.Timestamp) value).toLocalDateTime().toLocalTime()); | ||
} else if (value instanceof java.time.LocalDateTime) { | ||
return datetimeFormatter.format((java.time.LocalDateTime) value); | ||
} else { | ||
|
@@ -81,7 +85,10 @@ public void registerConverter(String columnType, ConverterRegistration<SchemaBui | |
return datetimeFormatter.format(((java.sql.Timestamp) value).toLocalDateTime()); | ||
} else if (value instanceof microsoft.sql.DateTimeOffset) { | ||
microsoft.sql.DateTimeOffset dateTimeOffset = (microsoft.sql.DateTimeOffset) value; | ||
return datetimeFormatter.format(dateTimeOffset.getOffsetDateTime().withOffsetSameInstant(ZoneOffset.UTC).toLocalDateTime()); | ||
return datetimeFormatter.format(dateTimeOffset | ||
.getOffsetDateTime() | ||
.withOffsetSameInstant(ZoneOffset.UTC) | ||
.toLocalDateTime()); | ||
} else if (value instanceof java.time.LocalDateTime) { | ||
return datetimeFormatter.format((java.time.LocalDateTime) value); | ||
} else { | ||
|
@@ -94,5 +101,4 @@ public void registerConverter(String columnType, ConverterRegistration<SchemaBui | |
break; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.