Skip to content

Commit

Permalink
Return mutable result. WILL BE SQUASHED
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelhoral committed Feb 5, 2024
1 parent 74967f6 commit 5c6579f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.sql.SQLException;
import java.util.LinkedHashMap;
import java.util.Map;

/**
Expand Down Expand Up @@ -76,9 +77,10 @@ public ResultMapper<Map<String, Object>> forTotalCount() {
* @return <i>object reference</i> result mapper
*/
public ResultMapper<Map<String, Object>> forObjectRef(boolean revision) throws SQLException {
// create mutable map because there are unfortunately components that want to mutate it
return revision
? rs -> Map.of("_id", rs.getString("objectid"), "_rev", rs.getString("rev"))
: rs -> Map.of("_id", rs.getString("objectid"));
? rs -> new LinkedHashMap<>(Map.of("_id", rs.getString("objectid"), "_rev", rs.getString("rev")))
: rs -> new LinkedHashMap<>(Map.of("_id", rs.getString("objectid")));
}

}

0 comments on commit 5c6579f

Please sign in to comment.