mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-17 14:55:28 +00:00
Refactor extract separate modules for each platform from ebean-api dbplatform
This commit is contained in:
1 parent
514bba4130
commit
e71e16c1ee
259 files changed
+3183
-1125
No files matched your search
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>platforms</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.16.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-platform-clickhouse</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>12.16.2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package io.ebean.platform.clickhouse;
|
||||
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.config.dbplatform.DbPlatformType;
|
||||
import io.ebean.config.dbplatform.DbType;
|
||||
import io.ebean.config.dbplatform.IdType;
|
||||
|
||||
import java.sql.Types;
|
||||
|
||||
public class ClickHousePlatform extends DatabasePlatform {
|
||||
|
||||
public ClickHousePlatform() {
|
||||
super();
|
||||
this.platform = Platform.CLICKHOUSE;
|
||||
//this.dbEncrypt =
|
||||
//this.historySupport =
|
||||
//this.exceptionTranslator =
|
||||
this.nativeUuidType = true;
|
||||
this.dbDefaultValue.setNow("now()");
|
||||
this.dbDefaultValue.setFalse("0");
|
||||
this.dbDefaultValue.setTrue("1");
|
||||
|
||||
this.dbIdentity.setIdType(IdType.IDENTITY);
|
||||
this.dbIdentity.setSupportsGetGeneratedKeys(false);
|
||||
this.dbIdentity.setSupportsSequence(false);
|
||||
this.dbIdentity.setSupportsIdentity(true);
|
||||
|
||||
this.booleanDbType = Types.INTEGER;
|
||||
dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("UInt8"));
|
||||
// using unsigned as default types ...
|
||||
dbTypeMap.put(DbType.TINYINT, new DbPlatformType("UInt8", false));
|
||||
dbTypeMap.put(DbType.SMALLINT, new DbPlatformType("UInt16", false));
|
||||
dbTypeMap.put(DbType.INTEGER, new DbPlatformType("UInt32", false));
|
||||
dbTypeMap.put(DbType.BIGINT, new DbPlatformType("UInt64", false));
|
||||
dbTypeMap.put(DbType.DECIMAL, new DbPlatformType("Decimal", 16, 3));
|
||||
dbTypeMap.put(DbType.DOUBLE, new DbPlatformType("Float64", false));
|
||||
dbTypeMap.put(DbType.DATE, new DbPlatformType("Date", false));
|
||||
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("DateTime", false));
|
||||
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("DateTime", false));
|
||||
dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("String", false));
|
||||
dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("String", false));
|
||||
dbTypeMap.put(DbType.CLOB, new DbPlatformType("String", false));
|
||||
dbTypeMap.put(DbType.JSONVARCHAR, new DbPlatformType("String", false));
|
||||
dbTypeMap.put(DbType.UUID, new DbPlatformType("UUID", false));
|
||||
dbTypeMap.put(DbType.INET, new DbPlatformType("String", false));
|
||||
dbTypeMap.put(DbType.CIDR, new DbPlatformType("String", false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNativeArrayType() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package io.ebean.platform.clickhouse;
|
||||
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.config.dbplatform.DatabasePlatformProvider;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
|
||||
/**
|
||||
* ClickHouse platform provider.
|
||||
*/
|
||||
public class ClickHousePlatformProvider implements DatabasePlatformProvider {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ClickHouse";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(String name) {
|
||||
return name.equals("clickhouse");
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabasePlatform create(String name) {
|
||||
return new ClickHousePlatform();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchByProductName(String productName) {
|
||||
return productName.contains("clickhouse");
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabasePlatform create(int majorVersion, int minorVersion, DatabaseMetaData meta, Connection connection) {
|
||||
return new ClickHousePlatform();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchPlatform(Platform platform) {
|
||||
return Platform.CLICKHOUSE.equals(platform);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabasePlatform create(Platform platform) {
|
||||
return new ClickHousePlatform();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* Clickhouse DB specific support.
|
||||
*/
|
||||
package io.ebean.platform.clickhouse;
|
||||
@@ -0,0 +1,8 @@
|
||||
module io.ebean.platform.clickhouse {
|
||||
|
||||
exports io.ebean.platform.clickhouse;
|
||||
|
||||
requires transitive io.ebean.api;
|
||||
|
||||
provides io.ebean.config.dbplatform.DatabasePlatformProvider with io.ebean.platform.clickhouse.ClickHousePlatformProvider;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
io.ebean.platform.clickhouse.ClickHousePlatformProvider
|
||||
Reference in new issue
Block a user