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

com.neko233.toolchain.storage.async.DataUniqueId Maven / Gradle / Ivy

package com.neko233.toolchain.storage.async;

import com.neko233.toolchain.common.base.StringUtils233;

import java.util.Map;
import java.util.function.BiFunction;

/**
 * @author SolarisNeko on 2023-02-05
 **/
public interface DataUniqueId {

    String UNIQUE_ID_SPLIT = ",";

    // -------------- API --------------

    /**
     * @return 该数据唯一标识, 常用 StringUtils233.join() 生成
     */
    String uniqueId();

    default String generateUniqueId(Object... objs) {
        if (objs == null || objs.length == 0) {
            return "";
        }
        return StringUtils233.join(UNIQUE_ID_SPLIT, objs);
    }


    /**
     * diy name : Object
     *
     * @return dao 操作参数.
     */
    Map daoOperateParams();

    /**
     * 合并数据函数, 用于合并同一个 uniqueId 的数据, 若没有, 则默认采用 overwrite 方式
     *
     * @return t1, t2 -> t-result
     */
    BiFunction mergeDataFunction();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy