package it.cavallium.dbengine.client; import java.util.function.Function; import reactor.core.publisher.Mono; public record LazyHitKey(Mono key, float score) { public LazyHitEntry withValue(Function> valueGetter) { return new LazyHitEntry<>(key, key.flatMap(valueGetter), score); } public Mono> resolve() { return key.map(k -> new HitKey<>(k, score)); } public Mono> resolveWithValue(Function> valueGetter) { return resolve().flatMap(key -> key.withValue(valueGetter)); } }