diff --git a/ballerina-tests/user-config-tests/tests/user_configs.bal b/ballerina-tests/user-config-tests/tests/user_configs.bal index deb2b4f..f968a9e 100644 --- a/ballerina-tests/user-config-tests/tests/user_configs.bal +++ b/ballerina-tests/user-config-tests/tests/user_configs.bal @@ -24,11 +24,11 @@ csv:ParseOption option4 = {nilValue: "", header: 4, skipLines: "1-5"}; csv:ParseOption option5 = {nilValue: "", header: 4, skipLines: "1-1"}; csv:ParseOption option6 = {nilValue: "()", header: false, skipLines: [1, 2]}; -csv:parseToRecordOption ptOption1 = {nilValue: "", header: 1, skipLines: [2, 4]}; -csv:parseToRecordOption ptOption2 = {nilValue: "", header: 1, skipLines: "2-4"}; -csv:parseToRecordOption ptOption3 = {nilValue: "", header: 4, skipLines: "1-5"}; -csv:parseToRecordOption ptOption4 = {nilValue: "", header: 4, skipLines: [-1, -2, 4, 2]}; -csv:parseToRecordOption ptOption5 = {header: false, skipLines: [-1, -2, 5, 3]}; +csv:ParseToRecordOption ptOption1 = {nilValue: "", header: 1, skipLines: [2, 4]}; +csv:ParseToRecordOption ptOption2 = {nilValue: "", header: 1, skipLines: "2-4"}; +csv:ParseToRecordOption ptOption3 = {nilValue: "", header: 4, skipLines: "1-5"}; +csv:ParseToRecordOption ptOption4 = {nilValue: "", header: 4, skipLines: [-1, -2, 4, 2]}; +csv:ParseToRecordOption ptOption5 = {header: false, skipLines: [-1, -2, 5, 3]}; // Invalid parser options csv:ParseOption invalidParserOptions1 = {header: 4}; diff --git a/ballerina/csv_api.bal b/ballerina/csv_api.bal index 3a51ab1..fbf5036 100644 --- a/ballerina/csv_api.bal +++ b/ballerina/csv_api.bal @@ -22,7 +22,7 @@ import ballerina/jballerina.java; # + options - Options to be used for filtering in the projection # + t - Target type # + return - On success, value belonging to the given target type, else returns an `csv:Error` value. -public isolated function parseStringToRecord(string s, parseToRecordOption options = {}, typedesc t = <>) +public isolated function parseStringToRecord(string s, ParseToRecordOption options = {}, typedesc t = <>) returns t|Error = @java:Method {'class: "io.ballerina.lib.data.csvdata.csv.Native"} external; # Converts byte[] to subtype of record array. @@ -31,7 +31,7 @@ public isolated function parseStringToRecord(string s, parseToRecordOption optio # + options - Options to be used for filtering in the projection # + t - Target type # + return - On success, value belonging to the given target type, else returns an `csv:Error` value. -public isolated function parseBytesToRecord(byte[] s, parseToRecordOption options = {}, typedesc t = <>) +public isolated function parseBytesToRecord(byte[] s, ParseToRecordOption options = {}, typedesc t = <>) returns t|Error = @java:Method {'class: "io.ballerina.lib.data.csvdata.csv.Native"} external; # Converts CSV byte-block-stream to subtype of record array. @@ -41,7 +41,7 @@ public isolated function parseBytesToRecord(byte[] s, parseToRecordOption option # + t - Target type # + return - On success, value belonging to the given target type, else returns an `csv:Error` value. public isolated function parseStreamToRecord(stream s, - parseToRecordOption options = {}, typedesc t = <>) + ParseToRecordOption options = {}, typedesc t = <>) returns t|Error = @java:Method {'class: "io.ballerina.lib.data.csvdata.csv.Native"} external; # Converts CSV string to subtype of anydata[][]. diff --git a/ballerina/types.bal b/ballerina/types.bal index eb7029f..3129d7c 100644 --- a/ballerina/types.bal +++ b/ballerina/types.bal @@ -55,7 +55,7 @@ public type ParseOption record {| |}; # Represents options for parsing data into records. -public type parseToRecordOption record {| +public type ParseToRecordOption record {| *ParseOption; # Custom headers for the data, if any. string[]? customHeaders = (); diff --git a/native/build.gradle b/native/build.gradle index d87213d..2fef0f3 100644 --- a/native/build.gradle +++ b/native/build.gradle @@ -68,6 +68,28 @@ spotbugsTest { enabled = false } +publishing { + publications { + mavenJava(MavenPublication) { + groupId project.group + artifactId "data.csv-native" + version = project.version + artifact jar + } + } + + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/ballerina-platform/module-ballerina-data.csv") + credentials { + username = System.getenv("publishUser") + password = System.getenv("publishPAT") + } + } + } +} + compileJava { doFirst { options.compilerArgs = [ diff --git a/native/src/main/java/io/ballerina/lib/data/csvdata/utils/DiagnosticLog.java b/native/src/main/java/io/ballerina/lib/data/csvdata/utils/DiagnosticLog.java index e7569df..6de4ee3 100644 --- a/native/src/main/java/io/ballerina/lib/data/csvdata/utils/DiagnosticLog.java +++ b/native/src/main/java/io/ballerina/lib/data/csvdata/utils/DiagnosticLog.java @@ -35,7 +35,7 @@ public final class DiagnosticLog { private static final String ERROR_PREFIX = "error"; private static final String CSV_CONVERSION_ERROR = "Error"; private static final String UNSUPPORTED_OPERATION_ERROR = "Error"; - private static final ResourceBundle MESSAGES = ResourceBundle.getBundle("error", Locale.getDefault()); + private static final ResourceBundle MESSAGES = ResourceBundle.getBundle("csv_error", Locale.getDefault()); private DiagnosticLog() { } diff --git a/native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/data/csvdata-native/resource-config.json b/native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/data/csvdata-native/resource-config.json index befe09e..fea4f2b 100644 --- a/native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/data/csvdata-native/resource-config.json +++ b/native/src/main/resources/META-INF/native-image/io.ballerina.stdlib/data/csvdata-native/resource-config.json @@ -1,6 +1,6 @@ { "bundles":[{ - "name":"error", + "name":"csv_error", "locales":[""] }] } diff --git a/native/src/main/resources/error.properties b/native/src/main/resources/csv_error.properties similarity index 100% rename from native/src/main/resources/error.properties rename to native/src/main/resources/csv_error.properties