package com.goer.common.utils.fisok.sqloy.core;

/**
 * @author : goer
 * @date : 2022/1/25
 * @desc : 数据库类型集合
 */
public enum DBType {
    JTDS("odps", ""),
    HSQL("hsql", ""),
    DB2("db2", ""),
    POSTGRESQL("postgresql", "PostgreSQL"),
    SYBASE("sybase", ""),
    SQL_SERVER("sqlserver", ""),
    ORACLE("oracle", ""),
    ALI_ORACLE("AliOracle", ""),
    MYSQL("mysql", ""),
    MARIADB("mariadb", ""),
    DERBY("derby", ""),
    HBASE("hbase", ""),
    HIVE("hive", ""),
    H2("h2", ""),
    DM("dm", "达梦数据库"),
    KINGBASE("kingbase", ""),
    GBASE("gbase", ""),
    XUGU("xugu", ""),
    OCEANBASE("oceanbase", ""),
    INFORMIX("informix", ""),
    ODPS("odps", "阿里云odps"),
    TERADATA("teradata", ""),
    LOG4JDBC("log4jdbc", "Log4JDBC"),
    PHOENIX("phoenix", ""),
    ENTERPRISEDB("edb", ""),
    KYLIN("kylin", ""),
    SQLITE("sqlite", ""),
    ALIYUN_ADS("aliyun_ads", ""),
    ALIYUN_DRDS("aliyun_drds", ""),
    PRESTO("presto", ""),
    ELASTIC_SEARCH("elastic_search", ""),
    CLICKHOUSE("clickhouse", "");

    private String name;
    private String comment;

    DBType(String name) {
        this.name = name;
    }

    DBType(String name, String comment) {
        this.name = name;
        this.comment = comment;
    }

    public String getName() {
        return name;
    }

    public String getComment() {
        return comment;
    }

    public static DBType getDBTypeByName(String name){
        DBType[] dbTypes = DBType.values();
        for(DBType dbType : dbTypes){
            if(name.equalsIgnoreCase(dbType.name)){
                return dbType;
            }
        }
        throw new IllegalArgumentException(name + "for DBType.name not exists");
    }

}
