package com.muyu.system.holder;

/**
 * @Author：张腾
 * @Package：com.muyu.system.holder
 * @Project：cloud-server-8
 * @name：DataSourcceContextHolder
 * @Date：2024/9/18 19:45
 */
public class DataSourceContextHolder {
    private static final ThreadLocal<String> DYNAMIC_DATASOURCE_KEY = new ThreadLocal<>();

    public static void setDatasourceMsg(String datasourceKey){
        DYNAMIC_DATASOURCE_KEY.set(datasourceKey);
    }

    public static String getDatasourceMsg(){
        return DYNAMIC_DATASOURCE_KEY.get();
    }

    public static void clearDataSourceKey(){
        DYNAMIC_DATASOURCE_KEY.remove();
    }
}
