-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Non-flattening MongoDb Debezium SMT (#204)
* matf-non-flattening-mongodb-debezium-smt - adds debezium mongo SMT for converting BSON before/after into typed Struct before/after
- Loading branch information
1 parent
423b4a8
commit 21d741e
Showing
17 changed files
with
2,144 additions
and
1 deletion.
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
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
55 changes: 55 additions & 0 deletions
55
...nect-transforms/src/main/java/io/debezium/connector/mongodb/transforms/ArrayEncoding.java
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.connector.mongodb.transforms; | ||
|
||
public enum ArrayEncoding { | ||
ARRAY("array"), | ||
DOCUMENT("document"); | ||
|
||
private final String value; | ||
|
||
ArrayEncoding(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
/** | ||
* Determine if the supplied value is one of the predefined options. | ||
* | ||
* @param value the configuration property value; may not be null | ||
* @return the matching option, or null if no match is found | ||
*/ | ||
public static ArrayEncoding parse(String value) { | ||
if (value == null) { | ||
return null; | ||
} | ||
value = value.trim(); | ||
for (ArrayEncoding option : ArrayEncoding.values()) { | ||
if (option.getValue().equalsIgnoreCase(value)) { | ||
return option; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
/** | ||
* Determine if the supplied value is one of the predefined options. | ||
* | ||
* @param value the configuration property value; may not be null | ||
* @param defaultValue the default value; may be null | ||
* @return the matching option, or null if no match is found and the non-null default is invalid | ||
*/ | ||
public static ArrayEncoding parse(String value, String defaultValue) { | ||
ArrayEncoding mode = parse(value); | ||
if (mode == null && defaultValue != null) { | ||
mode = parse(defaultValue); | ||
} | ||
return mode; | ||
} | ||
} |
Oops, something went wrong.