Skip to content

Commit

Permalink
Merge pull request #20 from SasinduDilshara/development-2
Browse files Browse the repository at this point in the history
Add package md as the readme file
  • Loading branch information
SasinduDilshara authored Aug 1, 2024
2 parents c06d54e + 3e44972 commit 1b1023e
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 11 deletions.
10 changes: 5 additions & 5 deletions ballerina-tests/user-config-tests/tests/user_configs.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
6 changes: 3 additions & 3 deletions ballerina/csv_api.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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<record{}[]> t = <>)
public isolated function parseStringToRecord(string s, ParseToRecordOption options = {}, typedesc<record{}[]> t = <>)
returns t|Error = @java:Method {'class: "io.ballerina.lib.data.csvdata.csv.Native"} external;

# Converts byte[] to subtype of record array.
Expand All @@ -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<record{}[]> t = <>)
public isolated function parseBytesToRecord(byte[] s, ParseToRecordOption options = {}, typedesc<record{}[]> 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.
Expand All @@ -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<byte[], error?> s,
parseToRecordOption options = {}, typedesc<record{}[]> t = <>)
ParseToRecordOption options = {}, typedesc<record{}[]> t = <>)
returns t|Error = @java:Method {'class: "io.ballerina.lib.data.csvdata.csv.Native"} external;

# Converts CSV string to subtype of anydata[][].
Expand Down
2 changes: 1 addition & 1 deletion ballerina/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ();
Expand Down
22 changes: 22 additions & 0 deletions native/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"bundles":[{
"name":"error",
"name":"csv_error",
"locales":[""]
}]
}
File renamed without changes.

0 comments on commit 1b1023e

Please sign in to comment.