All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.vonce.sql.provider.DynSchemaContextHolder Maven / Gradle / Ivy

The newest version!
package cn.vonce.sql.provider;

/**
 * 动态Schema持有者
 *
 * @author Jovi
 * @version 1.0
 * @email [email protected]
 * @date 2021/6/19 00:23
 */
public class DynSchemaContextHolder {

    private static final ThreadLocal contextHolder = new ThreadLocal<>();

    /**
     * 设置当前Schema
     *
     * @param schema
     */
    public static void setSchema(String schema) {
        contextHolder.set(schema);
    }

    /**
     * 获取Schema
     *
     * @return
     */
    public static String getSchema() {
        return contextHolder.get();
    }

    /**
     * 清除Schema
     */
    public static void clearSchema() {
        contextHolder.remove();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy