Skip to content

Commit

Permalink
Merge pull request #264 from kaneeldias/postgresql
Browse files Browse the repository at this point in the history
  • Loading branch information
kaneeldias authored Nov 29, 2023
2 parents e850636 + 264bdff commit 11c71ca
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 5 deletions.
6 changes: 3 additions & 3 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
org = "ballerina"
name = "persist"
version = "1.2.0"
version = "1.2.1"
authors = ["Ballerina"]
keywords = ["persist"]
repository = "https://github.com/ballerina-platform/module-ballerina-persist"
Expand All @@ -15,5 +15,5 @@ graalvmCompatible = true
[[platform.java17.dependency]]
groupId = "io.ballerina.persist"
artifactId = "persist-native"
version = "1.2.0"
path = "../native/build/libs/persist-native-1.2.0.jar"
version = "1.2.1"
path = "../native/build/libs/persist-native-1.2.1-SNAPSHOT.jar"
2 changes: 1 addition & 1 deletion ballerina/CompilerPlugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ id = "persist-compiler-plugin"
class = "io.ballerina.stdlib.persist.compiler.PersistCompilerPlugin"

[[dependency]]
path = "../compiler-plugin/build/libs/persist-compiler-plugin-1.2.0.jar"
path = "../compiler-plugin/build/libs/persist-compiler-plugin-1.2.1-SNAPSHOT.jar"
2 changes: 1 addition & 1 deletion ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ modules = [
[[package]]
org = "ballerina"
name = "persist"
version = "1.2.0"
version = "1.2.1"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public static final class Datastores {

public static final String MYSQL = "mysql";
public static final String MSSQL = "mssql";
public static final String POSTGRESQL = "postgresql";
public static final String IN_MEMORY = "inmemory";
public static final String GOOGLE_SHEETS = "googlesheets";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public static boolean isValidSimpleType(String type, String datastore) {
return isValidMysqlType(type);
case Constants.Datastores.MSSQL:
return isValidMssqlType(type);
case Constants.Datastores.POSTGRESQL:
return isValidPostgresqlType(type);
case Constants.Datastores.IN_MEMORY:
return isValidInMemoryType(type);
case Constants.Datastores.GOOGLE_SHEETS:
Expand All @@ -107,6 +109,8 @@ public static boolean isValidArrayType(String type, String datastore) {
return isValidMysqlArrayType(type);
case Constants.Datastores.MSSQL:
return isValidMssqlArrayType(type);
case Constants.Datastores.POSTGRESQL:
return isValidPostgresqlArrayType(type);
case Constants.Datastores.IN_MEMORY:
return isValidInMemoryArrayType(type);
case Constants.Datastores.GOOGLE_SHEETS:
Expand All @@ -122,6 +126,8 @@ public static boolean isValidImportedType(String modulePrefix, String identifier
return isValidMysqlImportedType(modulePrefix, identifier);
case Constants.Datastores.MSSQL:
return isValidMssqlImportedType(modulePrefix, identifier);
case Constants.Datastores.POSTGRESQL:
return isValidPostgresqlImportedType(modulePrefix, identifier);
case Constants.Datastores.IN_MEMORY:
return isValidInMemoryImportedType(modulePrefix, identifier);
case Constants.Datastores.GOOGLE_SHEETS:
Expand Down Expand Up @@ -159,6 +165,21 @@ public static boolean isValidMssqlType(String type) {
}
}

public static boolean isValidPostgresqlType(String type) {
switch (type) {
case INT:
case BOOLEAN:
case DECIMAL:
case FLOAT:
case STRING:
case ENUM:
return true;
default:
return false;
}
}


public static boolean isValidInMemoryType(String type) {
return true;
}
Expand Down Expand Up @@ -195,6 +216,16 @@ public static boolean isValidMssqlArrayType(String type) {
}
}

public static boolean isValidPostgresqlArrayType(String type) {
switch (type) {
case BYTE:
return true;
default:
return false;
}
}


public static boolean isValidInMemoryArrayType(String type) {
return true;
}
Expand Down Expand Up @@ -233,6 +264,22 @@ public static boolean isValidMssqlImportedType(String modulePrefix, String ident
}
}

public static boolean isValidPostgresqlImportedType(String modulePrefix, String identifier) {
if (!modulePrefix.equals(TIME_MODULE)) {
return false;
}
switch (identifier) {
case DATE:
case TIME_OF_DAY:
case UTC:
case CIVIL:
return true;
default:
return false;
}
}


public static boolean isValidInMemoryImportedType(String modulePrefix, String identifier) {
return true;
}
Expand Down

0 comments on commit 11c71ca

Please sign in to comment.